
Figure 8.7: The architecture for the application
When processing these events, SAX2Internal needs to know where it is in
the document tree. When handling a character event, for example, it needs
to know whether the text is attached to a name or to a price element. It
also needs to know whether the name is the product name or the vendor
name.
States
A SAX parser, unlike a DOM parser, does not provide context information.
Therefore, the application has to track its location within the document.
First, you have to identify all possible states and determine how to transi-
tion from one state to the next. It’s easy to derive states from the document
structure ...