Xerces-C++ 3.3.0
DefaultHandler Class Reference

Default base class for SAX2 handlers. More...

#include <xercesc/sax2/DefaultHandler.hpp>

Inheritance diagram for DefaultHandler:
EntityResolver DTDHandler ContentHandler ErrorHandler LexicalHandler DeclHandler

Public Member Functions

Default handlers for the DocumentHandler interface
virtual void characters (const XMLCh *const chars, const XMLSize_t length)
 Receive notification of character data inside an element.
 
virtual void endDocument ()
 Receive notification of the end of the document.
 
virtual void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
 Receive notification of the end of an element.
 
virtual void ignorableWhitespace (const XMLCh *const chars, const XMLSize_t length)
 Receive notification of ignorable whitespace in element content.
 
virtual void processingInstruction (const XMLCh *const target, const XMLCh *const data)
 Receive notification of a processing instruction.
 
virtual void resetDocument ()
 Reset the Document object on its reuse.
 
Default implementation of DocumentHandler interface
virtual void setDocumentLocator (const Locator *const locator)
 Receive a Locator object for document events.
 
virtual void startDocument ()
 Receive notification of the beginning of the document.
 
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.
 
virtual void startPrefixMapping (const XMLCh *const prefix, const XMLCh *const uri)
 Receive notification of the start of an namespace prefix mapping.
 
virtual void endPrefixMapping (const XMLCh *const prefix)
 Receive notification of the end of an namespace prefix mapping.
 
virtual void skippedEntity (const XMLCh *const name)
 Receive notification of a skipped entity.
 
Default implementation of the EntityResolver interface.
virtual InputSourceresolveEntity (const XMLCh *const publicId, const XMLCh *const systemId)
 Resolve an external entity.
 
Default implementation of the ErrorHandler interface
virtual void error (const SAXParseException &exc)
 Receive notification of a recoverable parser error.
 
virtual void fatalError (const SAXParseException &exc)
 Report a fatal XML parsing error.
 
virtual void warning (const SAXParseException &exc)
 Receive notification of a parser warning.
 
virtual void resetErrors ()
 Reset the Error handler object on its reuse.
 
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.
 
virtual void resetDocType ()
 Reset the DTD object on its reuse.
 
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.
 
Default implementation of LexicalHandler interface.
virtual void comment (const XMLCh *const chars, const XMLSize_t length)
 Receive notification of comments.
 
virtual void endCDATA ()
 Receive notification of the end of a CDATA section.
 
virtual void endDTD ()
 Receive notification of the end of the DTD declarations.
 
virtual void endEntity (const XMLCh *const name)
 Receive notification of the end of an entity.
 
virtual void startCDATA ()
 Receive notification of the start of a CDATA section.
 
virtual void startDTD (const XMLCh *const name, const XMLCh *const publicId, const XMLCh *const systemId)
 Receive notification of the start of the DTD declarations.
 
virtual void startEntity (const XMLCh *const name)
 Receive notification of the start of an entity.
 
- Public Member Functions inherited from EntityResolver
 EntityResolver ()
 Default Constructor.
 
virtual ~EntityResolver ()
 Destructor.
 
- Public Member Functions inherited from DTDHandler
 DTDHandler ()
 Default Constructor.
 
virtual ~DTDHandler ()
 Destructor.
 
- Public Member Functions inherited from ContentHandler
 ContentHandler ()
 Default constructor.
 
virtual ~ContentHandler ()
 Destructor.
 
- Public Member Functions inherited from ErrorHandler
 ErrorHandler ()
 Default constructor.
 
virtual ~ErrorHandler ()
 Destructor.
 
- Public Member Functions inherited from LexicalHandler
 LexicalHandler ()
 Default constructor.
 
virtual ~LexicalHandler ()
 Destructor.
 
- Public Member Functions inherited from DeclHandler
 DeclHandler ()
 Default constructor.
 
virtual ~DeclHandler ()
 Destructor.
 

Default implementation of DeclHandler interface.

virtual void elementDecl (const XMLCh *const name, const XMLCh *const model)
 Report an element type declaration.
 
virtual void attributeDecl (const XMLCh *const eName, const XMLCh *const aName, const XMLCh *const type, const XMLCh *const mode, const XMLCh *const value)
 Report an attribute type declaration.
 
virtual void internalEntityDecl (const XMLCh *const name, const XMLCh *const value)
 Report an internal entity declaration.
 
virtual void externalEntityDecl (const XMLCh *const name, const XMLCh *const publicId, const XMLCh *const systemId)
 Report a parsed external entity declaration.
 
 DefaultHandler ()
 
virtual ~DefaultHandler ()
 

Detailed Description

Default base class for SAX2 handlers.

This class implements the default behaviour for SAX2 interfaces: EntityResolver, DTDHandler, ContentHandler, ErrorHandler, LexicalHandler, and DeclHandler.

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
LexicalHandler::LexicalHandler
DeclHandler::DeclHandler

Constructor & Destructor Documentation

◆ DefaultHandler()

DefaultHandler::DefaultHandler ( )

◆ ~DefaultHandler()

virtual DefaultHandler::~DefaultHandler ( )
virtual

Member Function Documentation

◆ attributeDecl()

void DefaultHandler::attributeDecl ( const XMLCh *const eName,
const XMLCh *const aName,
const XMLCh *const type,
const XMLCh *const mode,
const XMLCh *const value )
virtual

Report an attribute type declaration.

Only the effective (first) declaration for an attribute will be reported.

Parameters
eNameThe name of the associated element.
aNameThe name of the attribute.
typeA string representing the attribute type.
modeA string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.
valueA string representing the attribute's default value, or null if there is none.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements DeclHandler.

◆ characters()

void DefaultHandler::characters ( const XMLCh *const chars,
const XMLSize_t 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
charsThe characters.
lengthThe number of characters to use from the character array.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
DocumentHandler::characters

Implements ContentHandler.

◆ comment()

void DefaultHandler::comment ( const XMLCh *const chars,
const XMLSize_t length )
virtual

Receive notification of comments.

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

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

Parameters
charsThe characters from the XML document.
lengthThe number of characters to read from the array.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements LexicalHandler.

◆ elementDecl()

void DefaultHandler::elementDecl ( const XMLCh *const name,
const XMLCh *const model )
virtual

Report an element type declaration.

The content model will consist of the string "EMPTY", the string "ANY", or a parenthesised group, optionally followed by an occurrence indicator. The model will be normalized so that all parameter entities are fully resolved and all whitespace is removed,and will include the enclosing parentheses. Other normalization (such as removing redundant parentheses or simplifying occurrence indicators) is at the discretion of the parser.

Parameters
nameThe element type name.
modelThe content model as a normalized string.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements DeclHandler.

◆ endCDATA()

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
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements LexicalHandler.

◆ endDocument()

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
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
DocumentHandler::endDocument

Implements ContentHandler.

◆ endDTD()

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
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements LexicalHandler.

◆ endElement()

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
uriThe URI of the associated namespace for this element
localnameThe local part of the element name
qnameThe QName of this element
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
DocumentHandler::endElement

Implements ContentHandler.

◆ endEntity()

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
nameThe name of the entity that is ending.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements LexicalHandler.

◆ endPrefixMapping()

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.

Parameters
prefixThe namespace prefix used
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
DocumentHandler::endPrefixMapping

Implements ContentHandler.

◆ error()

void DefaultHandler::error ( const SAXParseException & exc)
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
excThe warning information encoded as an exception.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
ErrorHandler::warning
SAXParseException::SAXParseException

Implements ErrorHandler.

◆ externalEntityDecl()

void DefaultHandler::externalEntityDecl ( const XMLCh *const name,
const XMLCh *const publicId,
const XMLCh *const systemId )
virtual

Report a parsed external entity declaration.

Only the effective (first) declaration for each entity will be reported.

Parameters
nameThe name of the entity. If it is a parameter entity, the name will begin with ''.
publicIdThe The declared public identifier of the entity, or null if none was declared.
systemIdThe declared system identifier of the entity.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements DeclHandler.

◆ fatalError()

void DefaultHandler::fatalError ( const SAXParseException & exc)
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
excThe error information encoded as an exception.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
ErrorHandler::fatalError
SAXParseException::SAXParseException

Implements ErrorHandler.

◆ ignorableWhitespace()

void DefaultHandler::ignorableWhitespace ( const XMLCh *const chars,
const XMLSize_t 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
charsThe whitespace characters.
lengthThe number of characters to use from the character array.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
DocumentHandler::ignorableWhitespace

Implements ContentHandler.

◆ internalEntityDecl()

void DefaultHandler::internalEntityDecl ( const XMLCh *const name,
const XMLCh *const value )
virtual

Report an internal entity declaration.

Only the effective (first) declaration for each entity will be reported. All parameter entities in the value will be expanded, but general entities will not.

Parameters
nameThe name of the entity. If it is a parameter entity, the name will begin with ''.
valueThe replacement text of the entity.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements DeclHandler.

◆ notationDecl()

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
nameThe notation name.
publicIdThe notation public identifier, or null if not available.
systemIdThe notation system identifier.
See also
DTDHandler::notationDecl

Implements DTDHandler.

◆ processingInstruction()

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
targetThe processing instruction target.
dataThe processing instruction data, or null if none is supplied.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
DocumentHandler::processingInstruction

Implements ContentHandler.

◆ resetDocType()

void DefaultHandler::resetDocType ( )
virtual

Reset the DTD object on its reuse.

See also
DTDHandler::resetDocType

Implements DTDHandler.

◆ resetDocument()

void DefaultHandler::resetDocument ( )
virtual

Reset the Document object on its reuse.

See also
DocumentHandler::resetDocument

◆ resetErrors()

void DefaultHandler::resetErrors ( )
virtual

Reset the Error handler object on its reuse.

See also
ErrorHandler::resetErrors

Implements ErrorHandler.

◆ resolveEntity()

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
publicIdThe public identifier, or null if none is available.
systemIdThe system identifier provided in the XML document.
Returns
The new input source, or null to require the default behaviour. The returned InputSource is owned by the parser which is responsible to clean up the memory.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
EntityResolver::resolveEntity

Implements EntityResolver.

◆ setDocumentLocator()

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
locatorA locator for all SAX document events.
See also
DocumentHandler::setDocumentLocator
Locator

Implements ContentHandler.

◆ skippedEntity()

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
nameThe 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
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements ContentHandler.

◆ startCDATA()

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
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements LexicalHandler.

◆ startDocument()

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
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
DocumentHandler::startDocument

Implements ContentHandler.

◆ startDTD()

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
nameThe document type name.
publicIdThe declared public identifier for the external DTD subset, or null if none was declared.
systemIdThe declared system identifier for the external DTD subset, or null if none was declared.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements LexicalHandler.

◆ startElement()

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
uriThe URI of the associated namespace for this element
localnamethe local part of the element name
qnamethe QName of this element
attrsThe specified or defaulted attributes.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
DocumentHandler::startElement

Implements ContentHandler.

◆ startEntity()

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
nameThe name of the entity that is starting.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.

Implements LexicalHandler.

◆ startPrefixMapping()

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.

Parameters
prefixThe namespace prefix used
uriThe namespace URI used.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
DocumentHandler::startPrefixMapping

Implements ContentHandler.

◆ unparsedEntityDecl()

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
nameThe entity name.
publicIdThe entity public identifier, or null if not available.
systemIdThe entity system identifier.
notationNameThe name of the associated notation.
See also
DTDHandler::unparsedEntityDecl

Implements DTDHandler.

◆ warning()

void DefaultHandler::warning ( const SAXParseException & exc)
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
excThe warning information encoded as an exception.
Exceptions
SAXExceptionAny SAX exception, possibly wrapping another exception.
See also
ErrorHandler::warning
SAXParseException::SAXParseException

Implements ErrorHandler.


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