Module java.xml
Package org.xml.sax

Interface XMLReader

All Known Subinterfaces:
XMLFilter
All Known Implementing Classes:
ParserAdapter, XMLFilterImpl

public interface XMLReader
Interface for reading an XML document using callbacks.

XMLReader is the interface that an XML parser's SAX2 driver must implement. This interface allows an application to set and query features and properties in the parser, to register event handlers for document processing, and to initiate a document parse.

All SAX interfaces are assumed to be synchronous: the parse methods must not return until parsing is complete, and readers must wait for an event-handler callback to return before reporting the next event.

This interface replaces the (now deprecated) SAX 1.0 Parser interface. The XMLReader interface contains two important enhancements over the old Parser interface (as well as some minor ones):

  1. it adds a standard way to query and set features and properties; and
  2. it adds Namespace support, which is required for many higher-level XML standards.

There are adapters available to convert a SAX1 Parser to a SAX2 XMLReader and vice-versa.

API Note:
Despite its name, this interface does not extend the standard Java Reader interface, because reading XML is a fundamentally different activity than reading character data.
Since:
1.4, SAX 2.0
See Also: