IMXSchemaDeclHandler Interface

MSXML 5.0 SDK

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

IMXSchemaDeclHandler Interface

The IMXSchemaDeclHandler interface provides schema information about the element being parsed, and about the attributes of that element.

Methods

schemaElementDecl Receives the schema element object for an element of the declared type, when it first appears in the document being parsed.

Versioning

MSXML 4.0 and later

Requirements

[Visual Basic, C/C++]

Implementation: msxml5.dll, msxml2.lib

[C/C++]

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

Remarks

The IMXSchemaDeclHandler interface registers with the SAXXMLReader by using the putProperty method. When you use the putProperty method, specify the "schema-declaration-handler" string identifier as the property name. For the property value, specify an event handler that you used to implement the IMXSchemaDeclHandler interface.

For example:

    oReader.putProperty("schema-declaration-handler", oMyDeclHandler)

This property is always read/write. When set, the declared handler (oMyDeclHandler) exposes the type information (i.e. the XSD schema) associated with an XML document.

In order to return type information, you also need to specify a schema. This requires further use of the putProperty method, as in the following example:

    oReader.putProperty("schemas", oSchemas)

In this example, the value of the schemas property (oSchemas) refers to a new instance of an XMLSchemaCache50 object.

The schema declaration handler only fires if the SAX validation feature is enabled. For example, the following line demonstrates how to enable validation on the reader:

    oReader.putFeature ("schema-validation", TRUE)