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

RE: Schema / XML document parsing

  • To: "xml-dev" <xml-dev@l...>
  • Subject: RE: Schema / XML document parsing
  • From: "Phil Fuhlman" <pfuhlman@D...>
  • Date: Fri, 19 Apr 2002 10:49:38 -0500
  • Thread-index: AcHnpRbuxeajnpbWSUCdL6t923LyIwAFdhnQ
  • Thread-topic: Schema / XML document parsing

xml parsing vbscript
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!

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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.