|
Answer» You should use a StAX parser when:
- You can process the XML document in a linear fashion from the top down.
- The document is not deeply nested.
- You are processing a very large XML document WHOSE DOM tree would CONSUME too much memory. Typical DOM implementations use ten bytes of memory to represent one byte of XML.
- The problem to be solved involves only part of the XML document.
- Data is available as soon as it is seen by the parser, so StAX works WELL for an XML document that ARRIVES over a STREAM.
You should use a StAX parser when:
|