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.

System_CAPS_ICON_note.jpg Note

Only one ContentHandler can be registered at a time.

charactersReceives notification of character data.
endDocumentReceives notification of the end of a document.
startDocumentReceives notification of the beginning of a document.
endElementReceives notification of the end of an element.
startElementReceives notification of the beginning of an element.
ignorableWhitespaceReceives 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.
endPrefixMappingIndicates the end of a namespace prefix that maps to a URI.
startPrefixMappingIndicates the beginning of a namespace prefix that maps to a URI.
processingInstructionReceives notification of a processing instruction.
skippedEntityReceives 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, IVBSAXContentHandlerhandles 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.

System_CAPS_ICON_important.jpg 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.

documentLocatorReceives 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.

putDocumentLocatorReceives an interface for locating the origin of SAX document events.

Implementation:

msxml3.dll, msxml2.lib (MSXML 3.0)

msxml6.dll, msxml6.lib (MSXML 4.0)

Header and LIB files: msxml2.h, msxml2.lib, msxml6.h, msxml6.lib

contentHandler Property (Visual Basic)
putContentHandler Method (C-C++)
ISAXLocator Interface

Show: