|
|
|
date: Tue, 15 Jul 2008 14:43:12 +0200,
group: microsoft.public.xml
back
Re: Property "NewParser" still needed in MSXML6?
Gerben Abbink wrote:
> In MSXML4 there's was a property "NewParser" so you could choose between the
> 'old' parser (slow, but with DTD support) or the 'new' parser (faster, but
> without DTD support).
>
> Is this property still needed in MSXML6? According to Microsoft
> (http://msdn.microsoft.com/en-us/library/ms767616(VS.85).aspx), the property
> is supported in MSXML6, but i don't see any difference.
Setting the property is possible with MSXML 6.
As for the difference, the following JScript program
var ver = '6.0';
var doc = new ActiveXObject('Msxml2.DOMDocument.' + ver);
doc.setProperty('NewParser', false);
doc.setProperty('ProhibitDTD', false);
doc.loadXML('<!DOCTYPE root [<!ELEMENT root (#PCDATA)>]><roo>foo</roo>');
WScript.Echo(doc.parseError.reason);
outputs
The name of the top most element 'roo' must match the name of the
DOCTYPE declaration 'root'.
When I change to using the NewParser
var ver = '6.0';
var doc = new ActiveXObject('Msxml2.DOMDocument.' + ver);
doc.setProperty('NewParser', true);
doc.setProperty('ProhibitDTD', false);
doc.loadXML('<!DOCTYPE root [<!ELEMENT root (#PCDATA)>]><roo>foo</roo>');
WScript.Echo(doc.parseError.reason);
the output is
DTD Validation when using the NewParser option or MXXMLWriter to build a
DOMDocument is not supported.
so the property works as documented. I have not done any tests to check
whether there is a speed difference.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
date: Tue, 15 Jul 2008 15:12:56 +0200
author: Martin Honnen
|
|