开发者

Cache XML File Java

I am 开发者_StackOverflow社区trying to Cache a XML File on application initialization. What would be the best approach to do it?

Which would be the most efficent datastructure which I can use? The datastructure should be efficent in lookups.

Thanks!


I assume that you want to cache the contents of the XML file, and not a reference to the file. You would first parse the XML, and then you could go a couple of ways. One way to do this would be to map the XML to a (object tree of) Java class, and then cache the Java class. You can use Castor or some JAXB library to do this. If your XML has a set of repeating nodes, you can consider an in-memory database to query on, such as HyperSQL. HyperSQL would allow you to use plain SQL for lookups.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜