class XMLDocumentHandler

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

Inheritance:


Public

Constructors and Destructor
XMLDocumentHandler ()
Default Constructor
virtual ~XMLDocumentHandler ()
Destructor
The document handler interfaces.
virtual void docCharacters ( const XMLCh* const chars, const unsigned int length, const bool cdataSection )
Receive notification of character data
virtual void docComment ( const XMLCh* const comment, const unsigned int fStartSrcOfs, const unsigned int fEndSrcOfs )
Receive notification of comments in the XML content being parsed
virtual void docPI ( const XMLCh* const target, const XMLCh* const data, const unsigned int fStartSrcOfs, const unsigned int fEndSrcOfs )
Receive notification of PI's parsed in the XML content
virtual void endDocument ()
Receive notification after the scanner has parsed the end of the document
virtual void endElement ( const XMLCh* const elementName, const bool isRoot, const unsigned int fStartSrcOfs, const unsigned int fEndSrcOfs )
This method is called when scanner encounters the end of element tag
virtual void endEntityReference (const XMLCh* const entityName)
This method is called when scanner encounters the end of an entity reference
virtual void ignorableWhitespace ( const XMLCh* const chars, const unsigned int length, const bool cdataSection )
Receive notification of ignorable whitespace in element content
virtual void resetDocument ()
This method is used to give the registered document handler a chance to reset itself
virtual void startDocument ()
This method is the first callback called the scanner at the start of every parse
virtual void startElement ( const XMLCh* const elementName, const RefVectorOf& attrList, const unsigned int attrCount, const bool isEmpty, const bool isRoot, const unsigned int fStartSrcOfs, const unsigned int fEndSrcOfs )
Receive notification when the scanner has finished scanning the start of element tag along with all the attributes
virtual void startEntityReference (const XMLCh* const entityName)
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, const unsigned int fStartSrcOfs, const unsigned int fEndSrcOfs )
Receive notification when the scanner hits the XML declaration clause in the XML file

Documentation

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.

Some of the methods are designated as 'advanced' callbacks. They are enabled only if the 'setAdvancedCallbacks' flag has been set on the default scanner implementation.

Constructors and Destructor

XMLDocumentHandler()
Default Constructor

virtual ~XMLDocumentHandler()
Destructor

The document handler interfaces.

virtual void docCharacters( const XMLCh* const chars, const unsigned int length, const bool cdataSection )
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

virtual void docComment( const XMLCh* const comment, const unsigned int fStartSrcOfs, const unsigned int fEndSrcOfs )
Receive notification of comments in the XML content being parsed.
Parameters:
comment - The text of the comment.

virtual void docPI( const XMLCh* const target, const XMLCh* const data, const unsigned int fStartSrcOfs, const unsigned int fEndSrcOfs )
Receive notification of PI's parsed in the XML content.
Parameters:
target - The name of the PI.
data - The body of the PI.

virtual void endDocument()
Receive notification after the scanner has parsed the end of the document

virtual void endElement( const XMLCh* const elementName, const bool isRoot, const unsigned int fStartSrcOfs, const unsigned int fEndSrcOfs )
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:
elementName - The name of the element whose end tag was just parsed.
isRoot - Indicates if this is the root element.

virtual void endEntityReference(const XMLCh* const entityName)
This method is called when scanner encounters the end of an entity reference.
Parameters:
entityName - The name of the entity reference just scanned.

virtual void ignorableWhitespace( const XMLCh* const chars, const unsigned int length, const bool cdataSection )
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

virtual void resetDocument()
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.

virtual void startDocument()
This method is the first callback called the scanner at the start of every parse

virtual void startElement( const XMLCh* const elementName, const RefVectorOf& attrList, const unsigned int attrCount, const bool isEmpty, const bool isRoot, const unsigned int fStartSrcOfs, const unsigned int fEndSrcOfs )
Receive notification when the scanner has finished scanning the start of element tag along with all the attributes.
Parameters:
elementName - The name of the element.
attrList - The list of attributes. Its returned as a list of references to attribute objects.
attrCount - The number of attributes in the attrList.
isEmpty - Indicates whether its an element or not. Empty elements are of the form .
isRoot - Indicates whether this element is the root element or not. If true, then there will be no separate endElement() event.

virtual void startEntityReference(const XMLCh* const entityName)
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:
entityName - The name of the entity that was referenced.

virtual void XMLDecl( const XMLCh* const versionStr, const XMLCh* const encodingStr, const XMLCh* const standaloneStr, const XMLCh* const autoEncodingStr, const unsigned int fStartSrcOfs, const unsigned int fEndSrcOfs )
Receive notification when the scanner hits the XML declaration clause in the XML file. Currently neither DOM nor SAX provide API's to return back this information. This is an advanced callback.
Parameters:
versionStr - The value of the version attribute of the XML decl.
encodingStr - The value of the encoding attribute of the XML decl.
standaloneStr - The value of the standalone attribute 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.

XMLDocumentHandler(const XMLDocumentHandler&)
The copy constructor, you cannot call this directly

void operator=(const XMLDocumentHandler&)
The assignment operator, you cannot call this directly


This class has no child classes.
Version:
Revision: 00 1.17.1.1 src/com/ibm/xml/framework/XMLDocumentHandler.hpp, xml4c2Framework, xml4c2_2_x

alphabetic index hierarchy of classes


XML Parser for C++ 2.0
Copyright © IBM Corp, 1999
Center for Java Technology
10275 N. De Anza Blvd.
Cupertino CA 95014 USA
Email: xml4c@us.ibm.com

IBM Logo