Xerces-C++: DefaultHandler Class Reference

Xerces-C++ 3.2.3

List of all members
DefaultHandler Class Reference

Default base class for SAX2 handlers. More...

Inheritance diagram for DefaultHandler:

## 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. 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 XMLSize_t 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 Document 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 InputSource * | resolveEntity (const XMLCh *const publicId, const XMLCh *const systemId)
| Resolve an external entity. More...
Default implementation of the ErrorHandler interface
virtual void | error (const SAXParseException &exc)
| Receive notification of a recoverable parser error. More...
virtual void | fatalError (const SAXParseException &exc)
| Report a fatal XML parsing error. More...
virtual void | warning (const SAXParseException &exc)
| 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 XMLSize_t 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...
Public Member Functions inherited from EntityResolver
| EntityResolver ()
| Default Constructor. More...
virtual | ~EntityResolver ()
| Destructor. More...
Public Member Functions inherited from DTDHandler
| DTDHandler ()
| Default Constructor. More...
virtual | ~DTDHandler ()
| Destructor. More...
Public Member Functions inherited from ContentHandler
| ContentHandler ()
| Default constructor. More...
virtual | ~ContentHandler ()
| Destructor. More...
Public Member Functions inherited from ErrorHandler
| ErrorHandler ()
| Default constructor. More...
virtual | ~ErrorHandler ()
| Destructor. More...
Public Member Functions inherited from LexicalHandler
| LexicalHandler ()
| Default constructor. More...
virtual | ~LexicalHandler ()
| Destructor. More...
Public Member Functions inherited from DeclHandler
| DeclHandler ()
| Default constructor. More...
virtual | ~DeclHandler ()
| Destructor. More...

## Default implementation of DeclHandler interface.
virtual void | elementDecl (const XMLCh *const name, const XMLCh *const model)
| Report an element type declaration. More...
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. More...
virtual void | internalEntityDecl (const XMLCh *const name, const XMLCh *const value)
| Report an internal entity declaration. More...
virtual void | externalEntityDecl (const XMLCh *const name, const XMLCh *const publicId, const XMLCh *const systemId)
| Report a parsed external entity declaration. More...
| 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

  eName | The name of the associated element.
  aName | The name of the attribute.
  type | A string representing the attribute type.
  mode | A string representing the attribute defaulting mode ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if none of these applies.
  value | A string representing the attribute's default value, or null if there is none.

Exceptions

  SAXException | Any 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

  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

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

  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.

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

  name | The element type name.
  model | The content model as a normalized string.

Exceptions

  SAXException | Any 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

  SAXException | Any 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

  SAXException | Any 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

  SAXException | Any 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

  uri | The URI of the associated 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

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

  name | The name of the entity that is ending.

Exceptions

  SAXException | Any 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

  prefix | The namespace prefix used

Exceptions

  SAXException | Any 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

  exc | The warning information encoded as an exception.

Exceptions

  SAXException | Any 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

  name | The name of the entity. If it is a parameter entity, the name will begin with ''.
  publicId | The The declared public identifier of the entity, or null if none was declared.
  systemId | The declared system identifier of the entity.

Exceptions

  SAXException | Any 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

  exc | The error information encoded as an exception.

Exceptions

  SAXException | Any 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

  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

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

  name | The name of the entity. If it is a parameter entity, the name will begin with ''.
  value | The replacement text of the entity.

Exceptions

  SAXException | Any 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

  name | The notation name.
  publicId | The notation public identifier, or null if not available.
  systemId | The 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

  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

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

  publicId | The public identifier, 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. The returned InputSource is owned by the parser which is responsible to clean up the memory.

Exceptions

  SAXException | Any 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

  locator | A 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

  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.

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

  SAXException | Any 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

  SAXException | Any 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

  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.

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

  uri | The URI of the associated namespace for this element
  localname | the local part of the element name
  qname | the QName of this element
  attrs | The specified or defaulted attributes.

Exceptions

  SAXException | Any 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

  name | The name of the entity that is starting.

Exceptions

  SAXException | Any 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

  prefix | The namespace prefix used
  uri | The namespace URI used.

Exceptions

  SAXException | Any 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

  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

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

  exc | The warning information encoded as an exception.

Exceptions

  SAXException | Any 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:

- DefaultHandler.hpp