Playing the SAX: Directly Feeding a ContentHandler

We showed in the previous section that parsers generate SAX events based on input from an XML document. We also explored some of the methods that belong to the ContentHandler interface . In the example, we wrote a simple event handler to process XML content, using stacks and maps to collect the data. Sometimes you'll need to work in the other direction—firing your own SAX events to a ContentHandler. This is not the easiest way to create a document, but it may be your only choice for creating an extremely large document.

It's possible to feed a ContentHandler by creating an instance of ...

Get Wicked Cool 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.