Talking to SAX Programs

JDOM works very well with SAX parsers. SAX is an almost-ideal event model for building a JDOM tree; and when the tree is complete, JDOM makes it easy to walk the tree, firing off SAX events as you go. Fast and memory efficient, SAX doesn't add a lot of extra overhead to JDOM programs.

Configuring SAXBuilder

When reading a file or stream through a SAX parser, you can set various properties on the parser, including the ErrorHandler, EntityResolver, DTDHandler, and any custom features or properties that are supported by the underlying SAX XMLReader. SAXBuilder includes several methods that delegate these configurations to the underlying XMLReader:

public void setErrorHandler (ErrorHandler errorHandler) 

public void setEntityResolver ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX 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.