ISAXContentHandler Interface
The ISAXContentHandler
/IVBSAXContentHandler
interface receives notification of the logical content of a document. This is the main interface implemented by most Simple API for XML (SAX) applications.
Note Only one ContentHandler
can be registered at a time.
Methods
characters | Receives notification of character data. |
endDocument | Receives notification of the end of a document. |
startDocument | Receives notification of the beginning of a document. |
endElement | Receives notification of the end of an element. |
startElement | Receives notification of the beginning of an element. |
ignorableWhitespace | Receives notification of ignorable white space in element content. This method is not called in the MSXML 4.0 and later, because the SAX2 implementation is nonvalidating. |
endPrefixMapping | Indicates the end of a namespace prefix that maps to a URI. |
startPrefixMapping | Indicates the beginning of a namespace prefix that maps to a URI. |
processingInstruction | Receives notification of a processing instruction. |
skippedEntity | Receives notification of a skipped entity. |
A SAX application must be informed of basic parsing events. To provide this information, it implements the IVBSAXContentHandler
interface and uses the contentHandler
property to register an instance with the SAXXML Reader. The reader then uses this instance to report basic document-related events, such as the start of elements, the end of elements, and character data.
The IVBSAXContentHandler
interface handles events passed by the SAXXMLReader
. The interface handles these events in the order of the information within the document being parsed. For example, IVBSAXContentHandler
handles the startElement
event, then all of the content of an element, and then the endElement
event. The content of an element can include character data, processing instructions, and subelements.
The interface includes a series of methods that the reader invokes during the parsing operation. The reader passes the appropriate information to the parameters of the method. To add functionality to a method, you add code to the method in the ContentHandler
implementation. In most cases, you will not call these methods yourself from within the ContentHandler
. Therefore, the syntax shown for the IVBSAXContentHandler
interface focuses on the implementation syntax, rather than the usage syntax.
Important The SAX2 reader passes string values to IVBSAXContentHandler
methods by reference, rather than by value.
Properties
In addition to the preceding methods, the following property also applies to the IVBSAXContentHandler
interface.
documentLocator | Receives an interface pointer to the IVBSAXLocator interface, which provides methods for returning the column number, line number, public ID, or system ID for a current document event. |
If a SAX application must be informed of basic parsing events, it implements the ISAXContentHandler
interface and uses the putContentHandler
method to register an instance with the SAXXML Reader. The reader then uses this instance to report basic document-related events, such as the start of elements, the end of elements, and character data.
The ISAXContentHandler
interface handles events passed by the SAXXMLReader
. The interface handles these events in the order of the information within the document being parsed. For example, ISAXContentHandler
handles the startElement
event, then all of the content of an element, and then the endElement
event. The content of an element can include character data, processing instructions, and subelements.
Methods
In addition to the preceding methods, the following method also applies to the ISAXContentHandler
interface.
putDocumentLocator | Receives an interface for locating the origin of SAX document events. |
Versioning
MSXML 3.0 and later
Requirements
Implementation: msxml5.dll
Header and LIB files: msxml2.h, msxml2.lib
To view reference information for Visual Basic or C/C++ only, click the Language Filter button in the upper-left corner of the page.
See Also
contentHandler Property (Visual Basic) | putContentHandler Method (C/C++) | IVBSAXLocator Interface