TIP: Click on subject to list as thread! ANSI
echo: nthelp
to: All
from: Adam
date: 2005-03-17 13:36:26
subject: Quick Question 4 Rich S wrt MSXML

From: Adam 

Dear Rich,

Some people need to do bulk schema checking of XML instances & they
want the instances to be schema checked using a number of XSD validation
tools (e.g. Xerces with the Schema checking enabled) & then the output
writing to a log file sorted by filename.

One of the required tools is MSXML4 such that the docs can be signed off as
being .net OK.

So....

I've written a quick swing gui thing which allows then to either choose a
dir full of .xml docs or a given xml doc (if they want to just validate a
single doc) & a list of validating parsers with tick boxes so that they
can choose what they want to use (e.g. if on *ix they'd not want to run
MSXML4)

Requirement:

I have a JavaScript thingy written by someone else which takes 3 args:

// This file is:  msxsd.js
// first parameter is an XML files to be read in;
// second parameter is the namespace;
// third parameter is the schema file

// validate parameters
if(WScript.Arguments.length != 3)
{
        WScript.Echo("msxsd takes three arguments - datafile, namespace, schema
- eg:");
        WScript.Echo('msxsd books.xml "" books.xsd');
}
else
{
        var cache = new ActiveXObject("Msxml2.XMLSchemaCache.4.0");
        cache.add(WScript.Arguments(1), WScript.Arguments(2));

        var xmldoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
        xmldoc.async = false;
        xmldoc.schemas = cache;
        xmldoc.load(WScript.Arguments(0));

        if(xmldoc.parseError.errorCode != 0)
                WScript.Echo("Houston, we have a problem: " +
xmldoc.parseError.errorCode + " " + xmldoc.parseError.reason);
        else
                WScript.Echo("no problems!");
}

This is fine for 1 requirement. However another req is that I should be
able to provide simply the XML file name & the parser should then go
off
& validate the file on the basis of the declared schemas & namespaces
contained within the file.

Any ideas? Basically I'd like to be able to slightly extend the
WScript.Arguments.length section such that an acceptable num of args would
also incude 1 & the assumption would be it was the xml file path.

I was looking to call the above via the runtime.exec but if you can think
of a better way doing the Java ActiveX bit then you could mention
it.

Can I just set the Msxml2.DOMDocument.4.0 to be validated? Can I set the
MSXML parser to do schema validation as you can with Xerces?

Also I notice that there is an MSXML5. Is there any major diff & if so,
should I use one over the other? I only care that a given instance will
either validate against a schema or not & if not will hopefully tell
the user why.


TIA

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™.