NewParser Property
Specifies whether to enable (true
) or disable (false
) the use of the new parser, which was introduced in MSXML 4.0, to load a DOM document. Setting the NewParser
property to false
causes subsequent DOM documents to be loaded using the old parser. Setting this property to true
causes DOM documents to be loaded using the new parser.
This property is supported in MSXML 6.0. The default value is false
.
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 "NewParser".
vBool
A VARIANT_BOOL value of true
or false
.
Remarks
The new parser is faster and more reliable than the old one, but it lacks support for asynchronous loading or DTD validation. The new parser will ignore the async
property and throw an exception when validation against a DTD is requested. Therefore, the default value of this property is false
.
For example, the following Visual Basic code fragment will fail because validation against a DTD is attempted while using the new parser. The dom
object will not be loaded.
Set dom = CreateObject("MSXML2.DOMDocument.6.0")
dom.setProperty "NewParser", true
dom.ValidateOnParse = true
dom.loadXML "<?xml version='1.0' ?><!DOCTYPE root [<!ELEMENT root (#PCDATA)>]><root a='bc'>abc</root>"
However, the above code snippet will work if the ValidateOnParse
property is turned off:
dom.ValidateOnParse = false
The following JScript code fragment also works:
dom.setProperty("NewParser", true);
dom.async = true;
dom.load("mytest.xml");
The second line above, however, will be ignored.
Versioning
This property is supported in MSXML 6.0. The default value is false
.
Applies to
Interface: IXMLDOMDocument2
Methods: setProperty | getProperty