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 classDefaultHandler
implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler { // Default implementation of the EntityResolver interface. public InputSourceresolveEntity
(StringpublicID
, StringsystemID
) throws SAXException { return null; } // Default implementation of the DTDHandler interface. public voidnotationDecl
(Stringname
, StringpublicID
, StringsystemID
) throws SAXException { } public voidunparsedEntityDecl
(Stringname
, StringpublicID
, StringsystemID
, StringnotationName
) throws SAXException{ } // Default implementation of the ContentHandler interface. public voidsetDocumentLocator
(Locatorlocator
) { } public voidstartDocument
( ) throws SAXException { } public voidendDocument
( ) throws SAXException { } public voidstartPrefixMapping
(Stringprefix
, Stringuri
) throws SAXException { } public voidendPrefixMapping
(Stringprefix
) throws SAXException { } public voidstartElement
(Stringuri
, StringlocalName
, 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.