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

Re: Validating against a Schema

  • From: Richard Featherstone <R.Featherstone@u...>
  • To: Eric van der Vlist <vdv@d...>
  • Date: Fri, 06 Jul 2001 10:10:33 +0100 (BST)

validating against external schema

Eric, 

Thanks for your help I understand the second part (i think) use

setValidating(true);

when creating the parser from the factory right?

but I'm still not sure how to set the parser up to use the schema. more
specifically what Java code will do this?


Cheers

Richard


On Fri, 6 Jul 2001, Eric van der Vlist wrote:

> Richard Featherstone wrote:
> > 
> > Could someone either tell me how or point me in the right direction to
> > find out how to validate an XML doc against a Schema using Java.  I can
> > parse without validating but don't know
> > 
> > a) how the parser can decide what Schema is being used from the XML doc
> > and where to locate it
> 
> First thing, you need to use a XML parser that supports W3C XML Schema
> such as Xerces-J [1] (1.4.1 or above) .
> 
> Then, the parser will have 3 ways to locate the schema to use.
> 
> 1) Parsers are required to provide an implementation specific way to
> define the schema locations as parameters.
> 
> Xerces-J does this through the                
> http://apache.org/xml/properties/schema/external-schemaLocation and
> http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation
> properties.
> 
> 2) Using the xsi:schemaLocation and xsi:noNamespaceSchemaLocation
> attributes in the instance document.
> 
> 3) Trying to dereference the URI associated with the namespace to see if
> there is a schema at this location.
>  
> > 
> > b) how to configure the parser to validate the doc against the schema
> 
> Using the "isValidating" method.
>  
> > I apologise if this is the wrong place to ask a question like this but
> > I've spent days looking everywhere for the answer.
> 
> You should have asked before ;=)
> 
> Hope this helps.
> 
> Eric
> 
> [1] http://xml.apache.org/xerces-j/index.html
> 
> > 
> > thanks in advance
> > 
> > Richard
> > 
> -- 
> See you at XTech in San Diego.
>              http://conferences.oreillynet.com/cs/os2001/view/e_spkr/790
> ------------------------------------------------------------------------
> Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
> http://xsltunit.org      http://4xt.org           http://examplotron.org
> ------------------------------------------------------------------------
> 



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.