## org.xml.sax.ext
Class DefaultHandler2

    java.lang.Object
      |
      +--org.xml.sax.helpers.DefaultHandler
            |
            +--org.xml.sax.ext.DefaultHandler2

public class DefaultHandler2
extends DefaultHandler
implements LexicalHandler, DeclHandler, EntityResolver2

This class extends the SAX2 base handler class to support the SAX2 `LexicalHandler`, `DeclHandler`, and `EntityResolver2` extensions. Except for overriding the original SAX1 resolveEntity() method the added handler methods just return. Subclassers may override everything on a method-by-method basis.

> This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.

Note: this class might yet learn that the ContentHandler.setDocumentLocator() call might be passed a `Locator2` object, and that the ContentHandler.startElement() call might be passed a `Attributes2` object.

Since:
  SAX 2.0 (extensions 1.1 alpha)

Constructor Summary
`DefaultHandler2()` Constructs a handler which ignores all parsing events.

Method Summary
`void` `attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String mode, java.lang.String value)`
`void` `comment(char[] ch, int start, int length)`
`void` `elementDecl(java.lang.String name, java.lang.String model)`
`void` `endCDATA()`
`void` `endDTD()`
`void` `endEntity(java.lang.String name)`
`void` `externalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)`
`InputSource` `getExternalSubset(java.lang.String name, java.lang.String baseURI)` Tells the parser that if no external subset has been declared in the document text, none should be used.
`void` `internalEntityDecl(java.lang.String name, java.lang.String value)`
`InputSource` `resolveEntity(java.lang.String publicId, java.lang.String systemId)` Invokes EntityResolver2.resolveEntity() with null entity name and base URI.
`InputSource` `resolveEntity(java.lang.String name, java.lang.String publicId, java.lang.String baseURI, java.lang.String systemId)` Tells the parser to resolve the systemId against the baseURI and read the entity text from that resulting absolute URI.
`void` `startCDATA()`
`void` `startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)`
`void` `startEntity(java.lang.String name)`

Methods inherited from class org.xml.sax.helpers.DefaultHandler
`characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultHandler2

    public DefaultHandler2()

  Constructs a handler which ignores all parsing events.

Method Detail

### startCDATA

    public void startCDATA()
                    throws SAXException

  Specified by:
    startCDATA in interface LexicalHandler

### endCDATA

    public void endCDATA()
                  throws SAXException

  Specified by:
    endCDATA in interface LexicalHandler

### startDTD

    public void startDTD(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
                  throws SAXException

  Specified by:
    startDTD in interface LexicalHandler

### endDTD

    public void endDTD()
                throws SAXException

  Specified by:
    endDTD in interface LexicalHandler

### startEntity

    public void startEntity(java.lang.String name)
                     throws SAXException

  Specified by:
    startEntity in interface LexicalHandler

### endEntity

    public void endEntity(java.lang.String name)
                   throws SAXException

  Specified by:
    endEntity in interface LexicalHandler

### comment

    public void comment(char[] ch,
                        int start,
                        int length)
                 throws SAXException

  Specified by:
    comment in interface LexicalHandler

### attributeDecl

    public void attributeDecl(java.lang.String eName,
                              java.lang.String aName,
                              java.lang.String type,
                              java.lang.String mode,
                              java.lang.String value)
                       throws SAXException

  Specified by:
    attributeDecl in interface DeclHandler

### elementDecl

    public void elementDecl(java.lang.String name,
                            java.lang.String model)
                     throws SAXException

  Specified by:
    elementDecl in interface DeclHandler

### externalEntityDecl

    public void externalEntityDecl(java.lang.String name,
                                   java.lang.String publicId,
                                   java.lang.String systemId)
                            throws SAXException

  Specified by:
    externalEntityDecl in interface DeclHandler

### internalEntityDecl

    public void internalEntityDecl(java.lang.String name,
                                   java.lang.String value)
                            throws SAXException

  Specified by:
    internalEntityDecl in interface DeclHandler

### getExternalSubset

    public InputSource getExternalSubset(java.lang.String name,
                                         java.lang.String baseURI)
                                  throws SAXException,
                                         java.io.IOException

  Tells the parser that if no external subset has been declared in the document text, none should be used.
  Specified by:
    getExternalSubset in interface EntityResolver2

### resolveEntity

    public InputSource resolveEntity(java.lang.String name,
                                     java.lang.String publicId,
                                     java.lang.String baseURI,
                                     java.lang.String systemId)
                              throws SAXException,
                                     java.io.IOException

  Tells the parser to resolve the systemId against the baseURI and read the entity text from that resulting absolute URI. Note that because the older DefaultHandler.resolveEntity(), method is overridden to call this one, this method may sometimes be invoked with null name and baseURI, and with the systemId already absolutized.
  Specified by:
    resolveEntity in interface EntityResolver2

### resolveEntity

    public InputSource resolveEntity(java.lang.String publicId,
                                     java.lang.String systemId)
                              throws SAXException,
                                     java.io.IOException

  Invokes EntityResolver2.resolveEntity() with null entity name and base URI. You only need to override that method to use this class.
  Overrides:
    resolveEntity in class DefaultHandler

Copyright © 2006 Apache XML Project. All Rights Reserved.