ElementScanner is a SAX filter that uses XPath-like expressions to select element nodes to build and notifies listeners when these elements becomes available during the SAX parse.

ElementScanner does not aim at providing a faster parsing of XML documents. Its primary focus is to allow the application to control the parse and to consume the XML data while they are being parsed. ElementScanner can be viewed as a high-level SAX parser that fires events conveying JDOM {@link org.jdom.Element elements} rather that XML tags and character data.

ElementScanner only notifies of the parsing of element nodes and does not support reporting the parsing of DOCTYPE data, processing instructions or comments except for those present within the selected elements. Application needing such data shall register a specific {@link org.xml.sax.ContentHandler} of this filter to receive them in the form of raw SAX events.

Please refer to ElementScanner for details on how to use ElementScanner within an application.

A sample application is also provided here, with an example XML file.