OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sample JScript validation using MSXML 4 (was: Re: Sample for C++schema validation using MSXML 4)

Just in case anyone wants to try msxml4 schema validation from the
command line, the following trivial script file might be helpful.

I wouldn't bother posting this but the doc and samples are still
excitingly beta... :)


// 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');
	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;
	if(xmldoc.parseError.errorCode != 0)
		WScript.Echo("We have a problem: " + xmldoc.parseError.errorCode + " "
+ xmldoc.parseError.reason);
		WScript.Echo("no problems!");