IMXSchemaDeclHandler Interface


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


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



Msxml6.dll, msxml6.lib

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


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 XMLSchemaCache 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)


Implemented in: MSXML 6.0