Content Pipeline Guide > SAX2 Filter Interfaces > ContentHandler
  
ContentHandler
ContentHandler is the interface that most SAX2 filters implement. Filters that need to be informed of basic parsing events implement the ContentHandler interface.
The pipeline ensures that the filter receives method calls defined by the ContentHandler interface from the preceding filter in the pipeline. The preceding filter uses ContentHandler to report basic document-related events, such as the start and end of elements and character data.
The pipeline guarantees that the first event seen by a filter is startDocument and the last event seen is endDocument unless an error terminates the pipeline process.
Since filters allow multiple inputs, the pipeline buffers the SAX events for all inputs except the currently active one. When the active input pipe receives the endDocument event, the pipeline releases buffered SAX events for the next pipe. If the next pipe receives the endDocument event, then the pipeline moves on to the next pipe, until the SAX events from all the inputs have been processed.
The pipeline ensures that a filter only sees one startDocument and one endDocument. The pipeline sends the startDocument event when it receives the startDocument event for the first input pipe. The pipeline sends the endDocument event after it receives the endDocument event for the last input pipe. The pipeline suppresses all other startDocument and endDocument events.
package org.xml.sax;
public interface ContentHandler
{
public void setDocumentLocator (Locator locator);
public void startDocument ()
throws SAXException;
public void endDocument()
throws SAXException;
public void startPrefixMapping (String prefix, String uri)
throws SAXException;
public void endPrefixMapping (String prefix)
throws SAXException;
public void startElement (String namespaceURI,
String localName, String qName,
Attributes atts)
throws SAXException;
public void endElement (String namespaceURI, String localName,
String qName)
throws SAXException;
public void characters (char ch[], int start, int length)
throws SAXException;
public void ignorableWhitespace (char ch[], int start,
int length)
throws SAXException;
public void processingInstruction (String target, String data)
throws SAXException;
public void skippedEntity (String name)
throws SAXException;
}