[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Schema / XML document parsing
The following VBScript exercises this feature in MSXML4. The major problem I have with MSXML4 is that it quits on the first error, versus trying to recover and continue, hopefully catching any and all problems in one pass. (So if any one knows how to change this behavior and will share it I'd be much obliged :) ). Set schemaCache = CreateObject("MSXML2.XMLSchemaCache.4.0") ' load schema - it reports its own terse syntax errors schemaCache.Add "", "C:\schema\model1.xsd" Set doc = CreateObject("MSXML2.DOMDocument.4.0") Set doc.schemas = schemaCache ' associate schema w/ data (xml doc) 'Now you are ready to load the XML document and do the validation: doc.async = False If Not doc.Load("C:\data\model1.xml") Then wscript.echo "Error loading XML document: " & doc.parseError.reason & " errcode: " & doc.parseError.errorCode & " line: " & doc.parseError.line & " filepos: " & doc.parseError.filepos & " linepos: " & doc.parseError.linepos & " srctext: " & doc.parseError.srcText else wscript.echo "no errors" End If -----Original Message----- From: Dean James Greenwood [mailto:D.Greenwood@c...] Sent: Friday, April 19, 2002 8:30 AM To: xml-dev Subject: Schema / XML document parsing Hello, Does anyone know of a class/tool which accepts a XML Document and the corresponding Schema for that document and validates the document against the schema (instance against the type)? -- Kind regards, Dean Dean James Greenwood BSc DCNDS MSc University College London mailto:dean@d... http://www.deangreenwood.com ----------------------------------------------------------------- The xml-dev list is sponsored by XML.org <http://www.xml.org>, an initiative of OASIS <http://www.oasis-open.org> The list archives are at http://lists.xml.org/archives/xml-dev/ To subscribe or unsubscribe from this list use the subscription manager: <http://lists.xml.org/ob/adm.pl>
|
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
|