| API Docs for SAX and DOM |

- Main Page
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# XMLDocumentHandler Class Reference

This abstract class provides the interface for the scanner to return XML document information up to the parser as it scans through the document. More...

Inheritance diagram for XMLDocumentHandler:

[legend]

List of all members.

## Public Member Functions

Destructor
virtual | ~XMLDocumentHandler ()
The document handler interface
virtual void | docCharacters (const XMLCh *const chars, const unsigned int length, const bool cdataSection)=0
| Receive notification of character data.
virtual void | docComment (const XMLCh *const comment)=0
| Receive notification of comments in the XML content being parsed.
virtual void | docPI (const XMLCh *const target, const XMLCh *const data)=0
| Receive notification of PI's parsed in the XML content.
virtual void | endDocument ()=0
| Receive notification after the scanner has parsed the end of the document.
virtual void | endElement (const XMLElementDecl &elemDecl, const unsigned int uriId, const bool isRoot, const XMLCh *const prefixName=0)=0
| Receive notification of the end of an element.
virtual void | endEntityReference (const XMLEntityDecl &entDecl)=0
| Receive notification when a referenced entity's content ends.
virtual void | ignorableWhitespace (const XMLCh *const chars, const unsigned int length, const bool cdataSection)=0
| Receive notification of ignorable whitespace in element content.
virtual void | resetDocument ()=0
| Reset the document handler's state, if required.
virtual void | startDocument ()=0
| Receive notification of the start of a new document.
virtual void | startElement (const XMLElementDecl &elemDecl, const unsigned int uriId, const XMLCh *const prefixName, const RefVectorOf< XMLAttr > &attrList, const unsigned int attrCount, const bool isEmpty, const bool isRoot)=0
| Receive notification of a new start tag.
virtual void | startEntityReference (const XMLEntityDecl &entDecl)=0
| Receive notification when the scanner hits an entity reference.
virtual void | XMLDecl (const XMLCh *const versionStr, const XMLCh *const encodingStr, const XMLCh *const standaloneStr, const XMLCh *const autoEncodingStr)=0
| Receive notification of an XML declaration.
virtual void | elementTypeInfo (const XMLCh *const , const XMLCh *const )
| Receive notification of the name and namespace of the type that validated the element corresponding to the most recent endElement event.

## Protected Member Functions

| XMLDocumentHandler ()

## Detailed Description

This abstract class provides the interface for the scanner to return XML document information up to the parser as it scans through the document.

The interface is very similar to org.sax.DocumentHandler, but has some extra methods required to get all the data out.

## Constructor & Destructor Documentation

virtual XMLDocumentHandler::~XMLDocumentHandler | ( |  | ) | `[virtual]`

XMLDocumentHandler::XMLDocumentHandler | ( |  | ) | `[protected]`

## Member Function Documentation

virtual void XMLDocumentHandler::docCharacters | ( | const XMLCh *const | chars,
|  | const unsigned int | length,
|  | const bool | cdataSection |
| ) |  |  | `[pure virtual]`

Receive notification of character data.

The scanner will call this method to report each chunk of character data. The scanner may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event will come from the same external entity, so that the Locator provides useful information.

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

Parameters:

  | chars | The content (characters) between markup from the XML document.
  | length | The number of characters to read from the array.
  | cdataSection | Indicates that this data is inside a CDATA section.

See also:
  ignorableWhitespace

  Locator

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::docComment | ( | const XMLCh *const | comment | ) | `[pure virtual]`

Receive notification of comments in the XML content being parsed.

This scanner will call this method for any comments found in the content of the document.

Parameters:

  | comment | The text of the comment.

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::docPI | ( | const XMLCh *const | target,
|  | const XMLCh *const | data |
| ) |  |  | `[pure virtual]`

Receive notification of PI's parsed in the XML content.

The scanner will call this method for any PIs it finds within the content of the document.

Parameters:

  | target | The name of the PI.
  | data | The body of the PI. This may be an empty string since the body is optional.

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::endDocument | ( |  | ) | `[pure virtual]`

Receive notification after the scanner has parsed the end of the document.

The scanner will call this method when the current document has been fully parsed. The handler may use this opportunity to do something with the data, clean up temporary data, etc...

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::endElement | ( | const XMLElementDecl & | elemDecl,
|  | const unsigned int | uriId,
|  | const bool | isRoot,
|  | const XMLCh *const | prefixName = `0` |
| ) |  |  | `[pure virtual]`

Receive notification of the end of an element.

This method is called when scanner encounters the end of element tag. There will be a corresponding startElement() event for every endElement() event, but not necessarily the other way around. For empty tags, there is only a startElement() call.

Parameters:

  | elemDecl | The name of the element whose end tag was just parsed.
  | uriId | The ID of the URI in the URI pool (only valid if name spaces is enabled)
  | isRoot | Indicates if this is the root element.
  | prefixName | The string representing the prefix name

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::endEntityReference | ( | const XMLEntityDecl & | entDecl | ) | `[pure virtual]`

Receive notification when a referenced entity's content ends.

This method is called when scanner encounters the end of an entity reference.

Parameters:

  | entDecl | The name of the entity reference just scanned.

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::ignorableWhitespace | ( | const XMLCh *const | chars,
|  | const unsigned int | length,
|  | const bool | cdataSection |
| ) |  |  | `[pure virtual]`

Receive notification of ignorable whitespace in element content.

Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models.

The scanner may return all contiguous whitespace in a single chunk, or it may split it into several chunks; however, all of the characters in any single event will come from the same external entity, so that the Locator provides useful information.

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

Parameters:

  | chars | The whitespace characters from the XML document.
  | length | The number of characters to read from the array.
  | cdataSection | Indicates that this data is inside a CDATA section.

See also:
  characters

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::resetDocument | ( |  | ) | `[pure virtual]`

Reset the document handler's state, if required.

This method is used to give the registered document handler a chance to reset itself. Its called by the scanner at the start of every parse.

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::startDocument | ( |  | ) | `[pure virtual]`

Receive notification of the start of a new document.

This method is the first callback called the scanner at the start of every parse. This is before any content is parsed.

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::startElement | ( | const XMLElementDecl & | elemDecl,
|  | const unsigned int | uriId,
|  | const XMLCh *const | prefixName,
|  | const RefVectorOf< XMLAttr > & | attrList,
|  | const unsigned int | attrCount,
|  | const bool | isEmpty,
|  | const bool | isRoot |
| ) |  |  | `[pure virtual]`

Receive notification of a new start tag.

This method is called when scanner encounters the start of an element tag. All elements must always have a startElement() tag. Empty tags will only have the startElement() tag and no endElement() tag.

Parameters:

  | elemDecl | The name of the element whose start tag was just parsed.
  | uriId | The ID of the URI in the URI pool (only valid if name spaces is enabled)
  | prefixName | The string representing the prefix name
  | attrList | List of attributes in the element
  | attrCount | Count of the attributes in the element
  | isEmpty | Indicates if the element is empty, in which case you should not expect an endElement() event.
  | isRoot | Indicates if this is the root element.

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::startEntityReference | ( | const XMLEntityDecl & | entDecl | ) | `[pure virtual]`

Receive notification when the scanner hits an entity reference.

This is currently useful only to DOM parser configurations as SAX does not provide any api to return this information.

Parameters:

  | entDecl | The name of the entity that was referenced.

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::XMLDecl | ( | const XMLCh *const | versionStr,
|  | const XMLCh *const | encodingStr,
|  | const XMLCh *const | standaloneStr,
|  | const XMLCh *const | autoEncodingStr |
| ) |  |  | `[pure virtual]`

Receive notification of an XML declaration.

Currently neither DOM nor SAX provide API's to return back this information.

Parameters:

  | versionStr | The value of the `version` pseudoattribute of the XML decl.
  | encodingStr | The value of the `encoding` pseudoattribute of the XML decl.
  | standaloneStr | The value of the `standalone` pseudoattribute of the XML decl.
  | autoEncodingStr | The encoding string auto-detected by the scanner. In absence of any 'encoding' attribute in the XML decl, the XML standard specifies how a parser can auto-detect. If there is no `encodingStr` this is what will be used to try to decode the file.

Implemented in AbstractDOMParser, and SAXParser.

virtual void XMLDocumentHandler::elementTypeInfo | ( | const XMLCh * | const,
|  | const XMLCh * | const |
| ) |  |  | `[virtual]`

Receive notification of the name and namespace of the type that validated the element corresponding to the most recent endElement event.

This event will be fired immediately after the endElement() event that signifies the end of the element to which it applies; no other events will intervene. This method is EXPERIMENTAL and may change, disappear or become pure virtual at any time.

This corresponds to a part of the information required by DOM Core level 3's TypeInfo interface.

Parameters:

  | typeName | local name of the type that actually validated the content of the element corresponding to the most recent endElement() callback
  | typeURI | namespace of the type that actually validated the content of the element corresponding to the most recent endElement() callback

Deprecated:

Reimplemented in AbstractDOMParser.

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

- XMLDocumentHandler.hpp

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