putProperty Method

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 - SAX2 Reference

putProperty Method

Sets the value of a property.

[Visual Basic]

Implementation Syntax

Sub putProperty(strName As String, varValue As Variant)

Usage Syntax

oMXValidator.putProperty(strName, varValue)

Parameters

strName
A string representing the name of the property.
varValue
The value that will be assigned to the property.

Return Values

The following table describes the results of calling the putProperty method.

Property Returns
schemas Raises a trappable error if the property value cannot be set.
schema-declaration-handler Sets the value of the property.
Other properties Trappable error.

Example

This example illustrates how to use the MXValidator CoClass. The sample code performs the following tasks.

  1. Creates a standalone SAX validator using an instance of MXValidator.
  2. Loads and assigns books.xsd as the XSD schema for use by the validator.
  3. Synthetically generates an XML document using SAX.
  4. Uses the standalone SAX validator to validate the document.
  5. Returns information on validation success or failure as output.

The example uses a resource file, books.xsd. We've provided source files for the sample in Visual Basic.

[C/C++]

Syntax

HRESULT putProperty(
   [in] BSTR strName,
   [in] VARIANT varValue);

Parameters

strName [in]
A string representing the name of the property.
varValue [in]
The value that will be assigned to the property.

Return Values

The following table describes the results of calling the putProperty method.

Property Returns
"schemas" S_OK (Not parsing.)

E_FAIL (Parsing.)

"schema-declaration-handler" S_OK (Regardless of parsing mode.)
Other properties E_FAIL

Remarks

The following properties are defined for the MXValidator:

"schemas"
Gets or sets the collection of one or more schemas to be used by the MXValidator when it validates the XML stream.

Datatype — XMLSchemaCache.

Access — (parsing) Read-only; (not parsing) Read/Write.

"schema-declaration-handler"
Gets or sets the schema-based declaration handler to be used by the MXValidator.

Datatype — Event handler that implements the IMXSchemaDeclHandler interface.

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

getProperty Property Method

Applies to: MXValidator CoClass