[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How do I validate against a schema?

Subject: Re: How do I validate against a schema?
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Fri, 10 Jan 2003 08:57:13 +0000
msxsd.js
Hi Adrian,

I wrote a JScript batch file to do this back in April 2001 [1], to my surprise it seems to use the final XML Schema namespace.

---
C:\Desktop\xml\Demo>type msxsd.js
// 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!");
}


C:\xml\Demo>msxsd books.xml "" books.xsd
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

no problems!

C:\Documents and Settings\francis\Desktop\xml\Demo>
---

I'm sure there are better around - your error reporting looks more sophisticated than mine was, for a start...

Francis.

[1] http://www.schemavalid.com/utils/msxsd.zip




XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.