This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes XML and Related Technologies and the fly likes Validation with JAXP and XML Schema Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Validation with JAXP and XML Schema" Watch "Validation with JAXP and XML Schema" New topic

Validation with JAXP and XML Schema

Shane Semanek

Joined: Jun 24, 2004
Posts: 4
I want to validate an XML document with an XML Schema using JAXP. The JAXP 1.2 samples show the following code to accomplish this:

final String JAXP_SCHEMA_LANGUAGE = "";
final String JAXP_SCHEMA_SOURCE = "";
final String W3C_XML_SCHEMA = "";

//create and configure SAX parser factory
SAXParserFactory spf = SAXParserFactory.newInstance();

//create and configure SAX parser
SAXParser saxParser = spf.newSAXParser();
saxParser.setProperty(JAXP_SCHEMA_SOURCE, new File(schemaSource));

//parse XML document
saxParser.parse(new InputSource(xmlURI), myDefaultHandler);

However, I would like to use the default Crimson parser that ships with J2SE 1.4. Is there a way to accomplish this using the default Crimson parser that only support JAXP 1.1?

Also, is there a place where all the JAXP parser properties, like, are listed?
Valentin Crettaz
Gold Digger

Joined: Aug 26, 2001
Posts: 7610
Moving this thread to the XML forum. Please continue this discussion there. Thank you

[Blog] [Blogroll] [My Reviews] My Linked In
I agree. Here's the link:
subject: Validation with JAXP and XML Schema