TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: Adam
from: Adam
date: 2005-03-17 14:56:38
subject: Re: Quick Question 4 Rich S wrt MSXML

From: Adam 

Digging through the MS docs....

I'm a bit confused...

In one place it says that coz validateOnParse is set to true by default
then all you need to do is load or loadXML

e.g:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xm
mthvalidate.asp


"The following MicrosoftR JScriptR example shows how to validate at runtime.

var xmldoc = new ActiveXObject("Msxml2.DOMDocument.3.0");
xmldoc.async = false
// This will validate on load because validateOnParse is set to true
// by default.
xmldoc.load("http://server/myData.xml");
// You make a change to an attribute:
xmldoc.documentElement.setAttribute("a", "123");
// Now you want to verify your document is still valid:
var err = xmldoc.validate();
if (err.errorCode == 0)
{
    WScript.Echo("Document is valid");
}
else
{
    WScript.Echo("Validation error:" + err.reason);
}
"

But in load & loadXML e.g.:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xm
mthloadxml.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/xm
mthload.asp

"You can use this method to check if the loaded XML document is
well-formed. You cannot use it to validate the XML document against a
schema."

So can I rely on simply calling load & catching any error code which
isn't 0 or should I call validate explicitly?


Adam

--- BBBS/NT v4.01 Flag-5
* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45)
SEEN-BY: 633/267 270 5030/786
@PATH: 379/45 1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.