http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Home

Readme
Installation
Build

API Docs
Samples
Programming
Migration
FAQs

Releases
Feedback
Bug-Todo

Download
CVS Repository
Mail Archive

API Docs for SAX and DOM
 

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

DefaultHandler Class Reference

Default base class for SAX2 handlers. More...

#include <DefaultHandler.hpp>

Inheritance diagram for DefaultHandler

Inheritance graph
[legend]
Collaboration diagram for DefaultHandler:

Collaboration graph
[legend]
List of all members.

Public Methods

Default handlers for the DocumentHandler interface
virtual void characters ( const XMLCh* const chars , const unsigned int length )
 Receive notification of character data inside an element. More...

virtual void endDocument ()
 Receive notification of the end of the document. More...

virtual void endElement ( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname )
 Receive notification of the end of an element. More...

virtual void ignorableWhitespace ( const XMLCh* const chars , const unsigned int length )
 Receive notification of ignorable whitespace in element content. More...

virtual void processingInstruction ( const XMLCh* const target , const XMLCh* const data )
 Receive notification of a processing instruction. More...

virtual void resetDocument ()
 Reset the Docuemnt object on its reuse. More...

Default implementation of DocumentHandler interface
virtual void setDocumentLocator (const Locator* const locator)
 Receive a Locator object for document events. More...

virtual void startDocument ()
 Receive notification of the beginning of the document. More...

virtual void startElement ( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname , const Attributes& attrs )
 Receive notification of the start of an element. More...

virtual void startPrefixMapping ( const XMLCh* const prefix, const XMLCh* const uri )
 Receive notification of the start of an namespace prefix mapping. More...

virtual void endPrefixMapping ( const XMLCh* const prefix )
 Receive notification of the end of an namespace prefix mapping. More...

virtual void skippedEntity ( const XMLCh* const name )
 Receive notification of a skipped entity. More...

Default implementation of the EntityResolver interface.
virtual InputSourceresolveEntity ( const XMLCh* const publicId , const XMLCh* const systemId )
 Resolve an external entity. More...

Default implementation of the ErrorHandler interface
virtual void error (const SAXParseException& exception)
 Receive notification of a recoverable parser error. More...

virtual void fatalError (const SAXParseException& exception)
 Report a fatal XML parsing error. More...

virtual void warning (const SAXParseException& exception)
 Receive notification of a parser warning. More...

virtual void resetErrors ()
 Reset the Error handler object on its reuse. More...

Default implementation of DTDHandler interface.
virtual void notationDecl ( const XMLCh* const name , const XMLCh* const publicId , const XMLCh* const systemId )
 Receive notification of a notation declaration. More...

virtual void resetDocType ()
 Reset the DTD object on its reuse. More...

virtual void unparsedEntityDecl ( const XMLCh* const name , const XMLCh* const publicId , const XMLCh* const systemId , const XMLCh* const notationName )
 Receive notification of an unparsed entity declaration. More...

Default implementation of LexicalHandler interface.
virtual void comment ( const XMLCh* const chars , const unsigned int length )
 Receive notification of comments. More...

virtual void endCDATA ()
 Receive notification of the end of a CDATA section. More...

virtual void endDTD ()
 Receive notification of the end of the DTD declarations. More...

virtual void endEntity (const XMLCh* const name)
 Receive notification of the end of an entity. More...

virtual void startCDATA ()
 Receive notification of the start of a CDATA section. More...

virtual void startDTD ( const XMLCh* const name , const XMLCh* const publicId , const XMLCh* const systemId )
 Receive notification of the start of the DTD declarations. More...

virtual void startEntity (const XMLCh* const name)
 Receive notification of the start of an entity. More...


Detailed Description

Default base class for SAX2 handlers.

This class implements the default behaviour for four SAX2 interfaces: EntityResolver, DTDHandler, Sax2DocumentHandler, and ErrorHandler.

Application writers can extend this class when they need to implement only part of an interface; parser writers can instantiate this class to provide default handlers when the application has not supplied its own.

Note that the use of this class is optional.

See also:
EntityResolver::EntityResolver , DTDHandler::DTDHandler , ContentHandler::ContentHandler , ErrorHandler::ErrorHandler


Member Function Documentation

void DefaultHandler::characters ( const XMLCh *const chars,
const unsigned int length ) [virtual]
 

Receive notification of character data inside an element.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of character data (such as adding the data to a node or buffer, or printing it to a file).

Parameters:
chars   The characters.
length   The number of characters to use from the character array.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
DocumentHandler::characters

Reimplemented from ContentHandler.

void DefaultHandler::comment ( const XMLCh *const chars,
const unsigned int length ) [virtual]
 

Receive notification of comments.

The Parser will call this method to report each occurence of a comment in the XML document.

The application must not attempt to read from the array outside of the specified range.

Parameters:
chars   The characters from the XML document.
length   The number of characters to read from the array.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.

Reimplemented from LexicalHandler.

void DefaultHandler::endCDATA ( ) [virtual]
 

Receive notification of the end of a CDATA section.

The SAX parser will invoke this method at the end of each CDATA parsed.

Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.

Reimplemented from LexicalHandler.

void DefaultHandler::endDTD ( ) [virtual]
 

Receive notification of the end of the DTD declarations.

The SAX parser will invoke this method at the end of the DTD

Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.

Reimplemented from LexicalHandler.

void DefaultHandler::endDocument ( ) [virtual]
 

Receive notification of the end of the document.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as finalising a tree or closing an output file).

Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
DocumentHandler::endDocument

Reimplemented from ContentHandler.

void DefaultHandler::endElement ( const XMLCh *const uri,
const XMLCh *const localname,
const XMLCh *const qname ) [virtual]
 

Receive notification of the end of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each element (such as finalising a tree node or writing output to a file).

Parameters:
uri   The URI of the asscioated namespace for this element
localname   The local part of the element name
qname   The QName of this element
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
DocumentHandler::endElement

Reimplemented from ContentHandler.

void DefaultHandler::endEntity ( const XMLCh *const name ) [virtual]
 

Receive notification of the end of an entity.

The SAX parser will invoke this method at the end of an entity

Parameters:
name   The name of the entity that is ending.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.

Reimplemented from LexicalHandler.

void DefaultHandler::endPrefixMapping ( const XMLCh *const prefix ) [virtual]
 

Receive notification of the end of an namespace prefix mapping.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the end of each namespace prefix mapping.

NOTE : The current Implementation of SAX2Parser will _NEVER_ call this

Parameters:
prefix   The namespace prefix used
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
DocumentHandler::endPrefixMapping

Reimplemented from ContentHandler.

void DefaultHandler::error ( const SAXParseException & exception ) [virtual]
 

Receive notification of a recoverable parser error.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each error, such as inserting the message in a log file or printing it to the console.

Parameters:
exception   The warning information encoded as an exception.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
ErrorHandler::warning , SAXParseException::SAXParseException

Reimplemented from ErrorHandler.

void DefaultHandler::fatalError ( const SAXParseException & exception ) [virtual]
 

Report a fatal XML parsing error.

The default implementation throws a SAXParseException. Application writers may override this method in a subclass if they need to take specific actions for each fatal error (such as collecting all of the errors into a single report): in any case, the application must stop all regular processing when this method is invoked, since the document is no longer reliable, and the parser may no longer report parsing events.

Parameters:
e   The error information encoded as an exception.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
ErrorHandler::fatalError , SAXParseException::SAXParseException

Reimplemented from ErrorHandler.

void DefaultHandler::ignorableWhitespace ( const XMLCh *const chars,
const unsigned int length ) [virtual]
 

Receive notification of ignorable whitespace in element content.

By default, do nothing. Application writers may override this method to take specific actions for each chunk of ignorable whitespace (such as adding data to a node or buffer, or printing it to a file).

Parameters:
chars   The whitespace characters.
length   The number of characters to use from the character array.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
DocumentHandler::ignorableWhitespace

Reimplemented from ContentHandler.

void DefaultHandler::notationDecl ( const XMLCh *const name,
const XMLCh *const publicId,
const XMLCh *const systemId ) [virtual]
 

Receive notification of a notation declaration.

By default, do nothing. Application writers may override this method in a subclass if they wish to keep track of the notations declared in a document.

Parameters:
name   The notation name.
publicId   The notation public identifier, or null if not available.
systemId   The notation system identifier.
See also:
DTDHandler::notationDecl

Reimplemented from DTDHandler.

void DefaultHandler::processingInstruction ( const XMLCh *const target,
const XMLCh *const data ) [virtual]
 

Receive notification of a processing instruction.

By default, do nothing. Application writers may override this method in a subclass to take specific actions for each processing instruction, such as setting status variables or invoking other methods.

Parameters:
target   The processing instruction target.
data   The processing instruction data, or null if none is supplied.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
DocumentHandler::processingInstruction

Reimplemented from ContentHandler.

void DefaultHandler::resetDocType ( ) [virtual]
 

Reset the DTD object on its reuse.

See also:
DTDHandler::resetDocType

Reimplemented from DTDHandler.

void DefaultHandler::resetDocument ( ) [virtual]
 

Reset the Docuemnt object on its reuse.

See also:
DocumentHandler::resetDocument

void DefaultHandler::resetErrors ( ) [virtual]
 

Reset the Error handler object on its reuse.

See also:
ErrorHandler::resetErrors

Reimplemented from ErrorHandler.

InputSource * DefaultHandler::resolveEntity ( const XMLCh *const publicId,
const XMLCh *const systemId ) [virtual]
 

Resolve an external entity.

Always return null, so that the parser will use the system identifier provided in the XML document. This method implements the SAX default behaviour: application writers can override it in a subclass to do special translations such as catalog lookups or URI redirection.

Parameters:
publicId   The public identifer, or null if none is available.
systemId   The system identifier provided in the XML document.
Returns:
The new input source, or null to require the default behaviour.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
EntityResolver::resolveEntity

Reimplemented from EntityResolver.

void DefaultHandler::setDocumentLocator ( const Locator *const locator ) [virtual]
 

Receive a Locator object for document events.

By default, do nothing. Application writers may override this method in a subclass if they wish to store the locator for use with other document events.

Parameters:
locator   A locator for all SAX document events.
See also:
DocumentHandler::setDocumentLocator , Locator

Reimplemented from ContentHandler.

void DefaultHandler::skippedEntity ( const XMLCh *const name ) [virtual]
 

Receive notification of a skipped entity.

The parser will invoke this method once for each entity skipped. All processors may skip external entities, depending on the values of the features:
http://xml.org/sax/features/external-general-entities
http://xml.org/sax/features/external-parameter-entities

Introduced with SAX2

Parameters:
name   The name of the skipped entity. If it is a parameter entity, the name will begin with %, and if it is the external DTD subset, it will be the string [dtd].
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.

Reimplemented from ContentHandler.

void DefaultHandler::startCDATA ( ) [virtual]
 

Receive notification of the start of a CDATA section.

The SAX parser will invoke this method at the start of each CDATA parsed.

Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.

Reimplemented from LexicalHandler.

void DefaultHandler::startDTD ( const XMLCh *const name,
const XMLCh *const publicId,
const XMLCh *const systemId ) [virtual]
 

Receive notification of the start of the DTD declarations.

The SAX parser will invoke this method at the start of the DTD

Parameters:
name   The document type name.
publicId   The declared public identifier for the external DTD subset, or null if none was declared.
systemId   The declared system identifier for the external DTD subset, or null if none was declared.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.

Reimplemented from LexicalHandler.

void DefaultHandler::startDocument ( ) [virtual]
 

Receive notification of the beginning of the document.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the beginning of a document (such as allocating the root node of a tree or creating an output file).

Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
DocumentHandler::startDocument

Reimplemented from ContentHandler.

void DefaultHandler::startElement ( const XMLCh *const uri,
const XMLCh *const localname,
const XMLCh *const qname,
const Attributes & attrs ) [virtual]
 

Receive notification of the start of an element.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).

Parameters:
uri   The URI of the asscioated namespace for this element
localname   the local part of the element name
qname   the QName of this element
attributes   The specified or defaulted attributes.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
DocumentHandler::startElement

Reimplemented from ContentHandler.

void DefaultHandler::startEntity ( const XMLCh *const name ) [virtual]
 

Receive notification of the start of an entity.

The SAX parser will invoke this method at the start of an entity

Parameters:
name   The name of the entity that is starting.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.

Reimplemented from LexicalHandler.

void DefaultHandler::startPrefixMapping ( const XMLCh *const prefix,
const XMLCh *const uri ) [virtual]
 

Receive notification of the start of an namespace prefix mapping.

By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each namespace prefix mapping.

NOTE : The current Implementation of SAX2Parser will _NEVER_ call this

Parameters:
prefix   The namespace prefix used
uri   The namespace URI used.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
DocumentHandler::startPrefixMapping

Reimplemented from ContentHandler.

void DefaultHandler::unparsedEntityDecl ( const XMLCh *const name,
const XMLCh *const publicId,
const XMLCh *const systemId,
const XMLCh *const notationName ) [virtual]
 

Receive notification of an unparsed entity declaration.

By default, do nothing. Application writers may override this method in a subclass to keep track of the unparsed entities declared in a document.

Parameters:
name   The entity name.
publicId   The entity public identifier, or null if not available.
systemId   The entity system identifier.
notationName   The name of the associated notation.
See also:
DTDHandler::unparsedEntityDecl

Reimplemented from DTDHandler.

void DefaultHandler::warning ( const SAXParseException & exception ) [virtual]
 

Receive notification of a parser warning.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each warning, such as inserting the message in a log file or printing it to the console.

Parameters:
e   The warning information encoded as an exception.
Exceptions:
SAXException   Any SAX exception, possibly wrapping another exception.
See also:
ErrorHandler::warning , SAXParseException::SAXParseException

Reimplemented from ErrorHandler.


The documentation for this class was generated from the following file:


Copyright © 2000 The Apache Software Foundation. All Rights Reserved.