ISAXDeclHandler Interface

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - SAX2 Reference

ISAXDeclHandler Interface

The ISAXDeclHandler/IVBSAXDeclHandler interface allows you to access declaration information about the following:

  • Element and attribute types
  • Internal and external entities

If you are using the DeclHandler with a LexicalHandler, all of the events occur between the startDTD and the endDTD events.

To set the DeclHandler for a SAX2 reader, use the putProperty method with the property ID, "http://xml.org/sax/properties/declaration-handler".

Methods

attributeDecl Receives/reports an attribute type declaration.
elementDecl Receives/reports an element type declaration.
externalEntityDecl Receives/reports a parsed external entity declaration.
internalEntityDecl Receives/reports a parsed internal entity declaration.

[Visual Basic]

The IVBSAXDeclHandler interface enables a Simple API for XML (SAX2) application to implement an optional extension handler that receives information about DTD declarations in an XML document. SAX2 readers are not required to support this handler, and this handler is not included in the core SAX2 distribution.

Data-related DTD declarations (unparsed entities and notations) are already reported through the IVBSAXDTDHandler interface.

The IVBSAXDeclHandler interface includes a series of methods that are invoked by the reader during the parsing operation. The reader passes the appropriate information to the parameters of the method. To perform some type of processing for a method, you add code to the method in the DeclHandler implementation. In general, you will rarely call these methods yourself from within the DeclHandler. Therefore, the syntax shown for the IVBSAXDeclHandler interface focuses on the implementation syntax, rather than the usage syntax.

Important   The SAX2 reader passes string values to IVBSAXDeclHandler methods by reference, rather than by value.
[C/C++]

This is an optional extension handler for SAX2 that provides information about DTD declarations in an XML document. Data-related DTD declarations (unparsed entities and notations) are already reported through the ISAXDTDHandler interface.

The following code shows how to use the putProperty method with the property ID, http://xml.org/sax/properties/declaration-handler, to set the DeclHandler for a SAX2 reader.

... SAXXMLReader * r = ...
SAXDeclHandler * dh = new SAXDeclHandler();
r->putProperty("http://xml.org/sax/properties/declaration-handler", _variant_t(dh));

Versioning

MSXML 3.0 and later

Requirements

Implementation: msxml5.dll

[C/C++]

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

To view reference information for Visual Basic or C/C++ only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

endDTD Method | ISAXDTDHandler Interface | putProperty Method | startDTD Method