10.3. SAX Filters

Applications that use a SAX parser must process the events that the parser produces. Often this task is simplified by using a filter to preprocess these events. A filter sits between the SAX parser and an application, processing the events from the parser before passing them on to the application (see Figure 10-1). Therefore, a filter must implement the SAX Parser interface and interact with the application as if it were the parser. A filter must also implement various event handler interfaces, including org.xml.sax.DocumentHandler, and interact with the parser as if it were the application. Inserting a filter between a SAX parser and an application can often be done with very few changes to the application.

Figure 10-1. An ...

Get Enterprise Application Integration With XML and Java™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.