File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes How to validate XML against XSD in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to validate XML against XSD in Java" Watch "How to validate XML against XSD in Java" New topic
Author

How to validate XML against XSD in Java

Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
hello friends,
I have one doubt:
How to validate XML against XSD in Java?, I am using jdk 1.4.2_08.
One more thing is apart from jdk 1.5 where i will get the support for package javax.xml.validation

Thanx in Advance
Shrinivas Mujumdar
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
You can use JDOM...

It will make document of XML only if it is valid...

JDOM APIs is not in JDK, you have to take jdom.jar into class path.
Rajagopal Manohar
Ranch Hand

Joined: Nov 26, 2004
Posts: 183
Originally posted by Shrinivas Mujumdar:
hello friends,
I have one doubt:
How to validate XML against XSD in Java?, I am using jdk 1.4.2_08.
One more thing is apart from jdk 1.5 where i will get the support for package javax.xml.validation

Thanx in Advance
Shrinivas Mujumdar


http://faq.javaranch.com/view?HowToValidateXmlAgainstAnySchema

-Rajagopal
Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
Hello Rajgopal,
Which version of Xerces.jar i am supposed to use? & how to check wheather my parser supports schema validation as mentioned in first line of link page?

Regards
Shrinivas
Rajagopal Manohar
Ranch Hand

Joined: Nov 26, 2004
Posts: 183
Originally posted by Shrinivas Mujumdar:
Hello Rajgopal,
Which version of Xerces.jar i am supposed to use? & how to check wheather my parser supports schema validation as mentioned in first line of link page?

Regards
Shrinivas


Ya I forgot the Crimson parser that comes bundled with java 1.4 does not support validation against schema

Regarding the first question any latest version of the xmlAPIs.jar and xercesImpl.jar from the apache website ought to do the trick

I think rather than relying on xerces api it is better to rely on Jaxp features

so maybe using code snippet is a better idea

Shrinivas Mujumdar
Ranch Hand

Joined: Aug 27, 2004
Posts: 328
Thanks a lot Rajgopal, I will try this
Shrinivas Mujumdar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to validate XML against XSD in Java
 
Similar Threads
XML validation against XSD
How to validate xml against a schema
validating xml with xsd
XML Schema Help
Validate XML from a string instead of a file?