Unlike element nodes, attribute nodes have text values.
If the processing you are doing is state-independent (meaning that it does not depend on the elements that have come before), then SAX works fine.
On the other hand, for state-dependent processing, where the program needs to do one thing with the data under element A but something different with the data under element B, then a pull parser such as the Streaming API for XML (St AX) would be a better choice.
, if its structure meets the XML specification, i.e., it is syntactically correct.
A well-formed XML document exhibits a tree-like structure, and can be processed by an XML processor.
SAX is fast and efficient, but its event model makes it most useful for such state-independent filtering.
For example, a SAX parser calls one method in your application when an element tag is encountered and calls a different method when text is found.
This can be done using the set Attribute() method or setting the node Value property of the attribute node.
GPath is a path expression language integrated into Groovy which allows parts of nested structured data to be identified.
SAX requires much less memory than DOM, because SAX does not construct an internal representation (tree structure) of the XML data, as a DOM does.
Instead, SAX simply sends data to the application as it is read; your application can then do whatever it wants to do with the data it sees.
With a pull parser, you get the next node, whatever it happens to be, at any point in the code that you ask for it.