[
Lists Home |
Date Index |
Thread Index
]
- To: "xml-dev" <xml-dev@lists.xml.org>
- Subject: RE: [xml-dev] Schema / XML document parsing
- From: "Phil Fuhlman" <pfuhlman@Dexma.com>
- Date: Fri, 19 Apr 2002 10:49:38 -0500
- Thread-index: AcHnpRbuxeajnpbWSUCdL6t923LyIwAFdhnQ
- Thread-topic: [xml-dev] 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@cs.ucl.ac.uk]
Sent: Friday, April 19, 2002 8:30 AM
To: xml-dev
Subject: [xml-dev] 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@deangreenwood.com
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>
|