1.

When you should use a StAX parser?

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.



Discussion

No Comment Found