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);