Compartilhar via


ValidateOnParse Property

 

This property is used to specify whether the XML parser should validate (true) this document against document type definition (DTD), schema, or schema cache on loading.

This property is supported in MSXML 6.0 and the default value is true.

This property has security implications. For more information, see MSXML Security Overview and DOM Security.

Script Syntax

domObj.setProperty(strProp, vBool);  
vBool = domObj.getProperty(strProp);  

Visual Basic Syntax

domObj.setProperty
(strProp, vBool)  
vBool = domObj.getProperty
(strProp)  

C\C++ Syntax

HRESULT setProperty(BSTR strProp, VARIANT vBool);  
HRESULT getProperty(BSTr strProp, VARIANT* vBool);  

Parameters

strProp
A BSTR string whose value is "ValidateOnParse".

vBool
A VARIANT_BOOL value of true/false.

Remarks

The following rules apply for the validation:

  1. If an external schema cache is set, the DTD will not be used to validate the document.

  2. If an external schema cache is not set, and the document has a DTD, XSD, or XDR schema file, will not be used to validate the document.

  3. Mixing XSD and XDR validation outside external cache is not permitted.

ValidateOnParse is also a first-level property on an XML DOM with the same effect. Thus, the following JScript code fragments accomplish the same:

dom.setProperty("ValidateOnParse", true);

and

dom.validateOnParse = true;

The second-level properties of ValidateOnParse, ResolveExternals and UseInlineSchema all deal with validation of an XML document. Collectively, they influence the behavior of the parser in different ways. For more information see the Remarks section of the UseInlineSchema property.

Versioning

This property is supported in MSXML 6.0. The default value is true.

Applies to

Interface:IXMLDOMDocument2

Methods:setProperty | getProperty

See Also

ResolveExternals Property
UseInlineSchema Property