Name

The DefaultHandler Class

Synopsis

DefaultHandler is a convenience class that implements the EntityResolver, DTDHandler, ContentHandler, and ErrorHandler interfaces with do-nothing methods. You can subclass DefaultHandler and override methods for events to which you actually want to respond. You never have to use this class. You can always implement the interfaces directly instead. The pattern is similar to the adapter classes in the AWT, such as MouseAdapter and WindowAdapter:

package org.xml.sax.helpers;
     
public class DefaultHandler
 implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler {
     
  // Default implementation of the EntityResolver interface.
  public InputSource resolveEntity(String publicID, String systemID)
   throws SAXException {
    return null;
  }
     
  // Default implementation of the DTDHandler interface.
  public void notationDecl(String name, String publicID, String systemID)
   throws SAXException {  }
  public void unparsedEntityDecl(String name, String publicID,
   String systemID, String notationName) throws SAXException{  }
     
  // Default implementation of the ContentHandler interface.
  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 uri, String localName, String qualifiedName, Attributes  ...

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.