JDOM2 Feature SAX Parsing Updates

rolfl edited this page Apr 8, 2012 · 6 revisions

The SAX parsing process has been significantly revamped with the internals being reworked with 4 objectives:

  1. Fix a memory-reference that was not being released when it should be (issue #52)
  2. Improve the performance of parser reuse
  3. Simplify the process of specifying SAX XMLReaders
  4. Simplify and rationalise the processes required for extending SAXBuilder and SAXHandler.

Some methods on SAXBuilder have been renamed to make the API more consistent (with the old names being deprecated, not removed). A whole new package has been created (org.jdom2.input.sax) to contain the classes now available to support the SAX parsing process.

The process for describing and acquiring the XMLReaders needed for SAX processing has been simplified to the extent that it should be possible to parse your document in almost any manner without having to set a SAX property or feature. JDOM should have a mechanism available that makes it possible to not have to worry about the parser settings ever again. Well, that's the goal. It is also now possible to set up complex XML validation using a very simple JDOM API. This should substantially reduce the learning curve involved - even the most complex XSD validations can now be one-liners.

See the JavaDoc documentation on SAXBuilder as well as the comprehensive package documentation on the org.jdom2.input.sax package.