Parsing very large XML documents (and a bit more) in java

后端 未结 6 770
青春惊慌失措
青春惊慌失措 2020-11-30 05:56

(All of the following is to be written in Java)

I have to build an application that will take as input XML documents that are, potentially, very large. The document

6条回答
  •  既然无缘
    2020-11-30 06:45

    This sounds like a job for StAX (JSR 173). StAX is a pull parser, which means that it works more or less like an event based parser like SAX, but that you have more control over when to stop reading, which elements to pull, ...

    The usability of this solution will depend a lot on what your extension classes are actually doing, if you have control over their implementation, etc...

    The main point is that if the document is very large, you probably want to use an event based parser and not a tree based, so you will not use a lot of memory.

    Implementations of StAX can be found from SUN (SJSXP), Codehaus or a few other providers.

提交回复
热议问题