ISAXXMLReader Interface
The ISAXXMLReader
/IVBSAXXMLReader
interface allows an application to set and query features and properties in Microsoft® XML Core Services (MSXML), register event handling for document processing, and initiate a document parse.
With MSXML 3.0 and MSXXML 6.0, version-dependent CoClasses are provided that implement this interface. For more information on each version-specific CoClass, refer to the version-specific GUID and Prog ID reference topics in the GUIDs and ProgID Information section.
With MSXML 6.0, you can throw SAX events from a DOMDocument
object by specifying the DOMDocument
object as the input parameter for the parse
method. For more information, see Convert DOM to SAX.
Properties
baseURL | Sets the base URL for the current document. |
contentHandler | Sets the current ContentHandler . |
dtdHandler | Sets the current DTDHandler . |
entityResolver | Sets the current EntityResolver . |
errorHandler | Registers or returns the current ErrorHandler . |
secureBaseURL | Sets the secure base URL for the document. |
Methods
getFeature | Returns the Boolean value of a feature. Allows an application to ask the reader if it supports a feature. |
putFeature | Sets the value of a feature. Allows an application to request that the reader turn a feature on or off. |
getProperty | Returns the value of a property (as a string), for any qualified Uniform Resource Identifier (URI). Allows an application to ask the reader the value of one its properties. |
putProperty | Sets the value of a property. Allows an application to set a property of the SAX reader. |
parse | Parses an XML document or a DOMDocument object. |
parseURL | Parses an XML document from a system identifier. |
The IVBSAXXMLReader
interface is implemented in the Simple API for XML (SAX2) applications to manage and execute the parsing of an XML document.
Controlling Reader Behavior
The Microsoft COM/Visual Basic® implementation of SAX2 supports a number of features and properties. To observe and control features of the SAX reader, you use the getFeature annd putFeature methods. Likewise, to read or set properties of the SAX reader, you use the getProperty and putProperty methods.
For more information, see SAX Reader Features and SAX Reader Properties.
Note
The reader recognizes the "http://xml.org/sax/features/string-interning"
and "schema-validation"
features. However, you cannot set these features in the current SAX2 implementation.
Creating an Instance of the Reader
Typically, you create an instance of the reader in the Main form of a Visual Basic application. For example, first you declare a variable for holding a reference to the IVBSAXXMLReader
interface. You then create a version-specific instance of the reader (in this example, MSXML 6.0) and assign the interface to the object variable as follows:
Dim reader As SAXXMLReader60
Set reader = New SAXXMLReader60
Creating an Instance of a Handler
After you create an instance of the reader, you can create an instance of a ContentHandler
or ErrorHandler
, and then set them as properties of the reader object using the contentHandler
and errorHandler
properties.
Registering Handlers
An application can set and query features in the reader, register event handlers for document processing, and initiate a document parse. With this COM/C++ implementation of SAX2, the reader can use the following methods to register the corresponding handlers:
putContentHandler
Registers a ContentHandler
.
putDTDHandler
Registers a DTDHandler
.
putErrorHandler
Registers an ErrorHandler
.
Methods
In addition to the preceding methods, the following also apply to the ISAXXMLReader
interface.
getBaseURL | Returns the base URL for the document. |
putBaseURL | Sets the base URL for the document. |
getContentHandler | Returns the current ContentHandler . |
putContentHandler | Allows an application to register a ContentHandler . |
getDTDHandler | Returns the current DTDHandler . |
putDTDHandler | Allows an application to register a DTDHandler . |
getEntityResolver | Returns the current EntityResolver . |
putEntityResolver | Allows an application to register an EntityResolver . |
getErrorHandler | Returns the current ErrorHandler . |
putErrorHandler | Allows an application to register an ErrorHandler . |
getSecureBaseURL | Returns the secure base URL for the document. |
putSecureBaseURL | Sets the secure base URL for the document. |
Requirements
Implementation:
msxml3.dll, msxml2.lib (MSXML 3.0)
msxml6.dll, msxml6.lib (MSXML 6.0)
Header and LIB files: msxml2.h, msxml2.lib , msxml6.h, msxml6.lib
Versioning
Implemented in: MSXML 3.0 and later