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

RE: Zerces 1.4.2, JAXP, schema - can't validate

  • From: Pete Sahm <psahm@u...>
  • To: XML Dev List <xml-dev@l...>
  • Date: Tue, 07 Aug 2001 16:34:43 -0400

jaxp schema
Thanks for the reply / confirmation. More comments and questions in-line...

At 8/7/2001 03:52 AM, Zehavi, Gil wrote:
>You need to tell the parser to use the schema for validation using:
>setFeature("http://apache.org/xml/features/validation/schema", true);

----
I think that is what DocumentBuilderFactory.setValidating(boolean) is 
supposed to do, and, to an extent is doing (as parser does try to validate 
the elements as they are encountered). The JAXP only supports 
setFeature(String, Object).


>I could not manage to do it (setFeature command) using the same code you
>wrote. Therefore I used the DOMParser class to parse the doc and then
>continue with JAXP classes. Here is the code:
>
>DOMParser parser = new DOMParser();
>parser.setFeature("http://xml.org/sax/features/validation", true);
>parser.setFeature("http://apache.org/xml/features/validation/schema", true);
>parser.setErrorHandler(_errorHandler);
>parser.parse(filePath);
>Document doc = parser.getDocument();

----
This does work, but is not JAXP compliant.

What really appears to be occurring is that the schema location is simply 
being ignored - as I can put anything in the noNamespaceSchemaLocation / 
SchemaLocation attribute and get the same results. I figured I would at 
least get an error if the schema document couldn't be obtained.

Should an error be thrown if the document referenced by the URI can't be 
obtained? Is this a bug in Xerces or am I the one with coding?

Pete


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.