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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.