| API Docs for SAX and DOM |
| Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages # DefaultHandler Class Reference Default base class for SAX2 handlers. More... Inheritance diagram for DefaultHandler: [legend] List of all members.
## Public Member Functions
| DefaultHandler ()
virtual | ~DefaultHandler ()
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.
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 unsigned int 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 Docuemnt 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 InputSource * | resolveEntity (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 unsigned int 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.
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.
## 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 | ( |  | ) |
virtual DefaultHandler::~DefaultHandler | ( |  | ) | `[virtual]`
## Member Function Documentation
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.
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 Implements 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.
Implements LexicalHandler.
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.
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.
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.
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.
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 Implements 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.
Implements 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. Parameters:
  | prefix | The namespace prefix used
  Exceptions:
  | SAXException | Any SAX exception, possibly wrapping another exception.
See also: DocumentHandler#endPrefixMapping Implements ContentHandler.
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.
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.
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.
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 Implements ContentHandler.
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.
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.
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.
void DefaultHandler::resetDocType | ( |  | ) | `[virtual]`
| Reset the DTD object on its reuse. See also: DTDHandler::resetDocType Implements 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 Implements 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. 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.
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.
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.
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.
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.
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.
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
  | attrs | The specified or defaulted attributes.
  Exceptions:
  | SAXException | Any SAX exception, possibly wrapping another exception.
See also: DocumentHandler::startElement Implements 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.
Implements 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. 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.
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.
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

Copyright © 1994-2004 The Apache Software Foundation. All Rights Reserved.