Is it possible to "split" XML tree to more subsets and then use different parsers for parsing?
DOM parser puts whole document to memory and then analyze it, so i guess there is no point to use that for reading subsets. Could i use Push and pull parsers(SAX and StAX) for parsing subsets?
thanks
Actually my question is bad... i am looking for something like: When is it good to combine StAX and SAX for reading XML files
Whenever possible I would recommend sticking with the StAX APIs. They are faster and IMHO are easier to use than SAX. The exception to this when you are using a ContentHandler
to process the XML then SAX is easier. If you hava a StAX XMLStreamReader
and need to interact with a ContentHandler
then you could use a Transformer
for this.
StAXSource source = new StAXSource(xmlStreamReader);
SAXResult result = new SAXResult(conentHandler);
transformer.transform(source, result);