XML DOM Properties


validateOnParse Property

Indicates whether the parser should validate this document.

Script Syntax

boolValue = oXMLDOMDocument.validateOnParse;
objXMLDOMDocument.validateOnParse = boolValue;

Example

J#
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmlDoc.async = false;
xmlDoc.validateOnParse = true;
xmlDoc.load("books.xml");
if (xmlDoc.parseError.errorCode != 0) {
   var myErr = xmlDoc.parseError;
   WScript.Echo("You have error " + myErr.reason);
}

Visual Basic Syntax

boolValue = oXMLDOMDocument.validateOnParse
objXMLDOMDocument.validateOnParse = boolValue

Example

Visual Basic
Dim xmlDoc As New Msxml2.DOMDocument30
xmlDoc.async = False
xmlDoc.validateOnParse = True
xmlDoc.Load "books.xml"
If (xmlDoc.parseError.errorCode <> 0) Then
   Dim myErr
   Set myErr = xmlDoc.parseError
   MsgBox("You have error " & myErr.reason)
End If

C/C++ Syntax

HRESULT get_validateOnParse(
    VARIANT_BOOL *isValidating);
HRESULT put_validateOnParse(
    VARIANT_BOOL isValidating);

Parameters

isValidating[out, retval][in]

If True, validates during parsing. If False, parses only for well-formed XML.

C/C++ Return Values

S_OK

The value returned if successful.

E_INVALIDARG (for get_validateOnParseonly)

The value returned if the isValidating parameter is Null.

Remarks

Boolean. The property is read/write. If True, it validates during parsing. If False, it parses only for well-formed XML. The default is True.

This member is an extension of the World Wide Web Consortium (W3C) Document Object Model (DOM).

Versioning

Implemented in:

MSXML 2.0 and later

Applies to

Page view tracker