[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: How do I validate against a schema?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|