XML Validation

Posted by Keya on Stack Overflow See other posts from Stack Overflow or by Keya
Published on 2009-07-22T07:37:05Z Indexed on 2010/03/31 22:43 UTC
Read the original article Hit count: 531

Filed under:
|
|

Hi,

I want to validate an XML file against RELAXNG schema provided. Searching on the net gave me hints to create a Schema instance using SchemaFactory by providing the appropriate Schema Language. So as per my requirement I used:

*SchemaFactory.newInstance(XMLConstants.RELAXNG_NS_URI);*

But the following exception was thrown at run:

Exception in thread "main" java.lang.IllegalArgumentException: No SchemaFactory that implements the schema language specified by: http://relaxng.org/ns/structure/1.0 could be loaded
at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:207)

I am using Java6 and observed that only 'W3C_XML_SCHEMA_NS_URI' works. Rest all the schema URIs throws the similar exception.

I am fairly new to using the XML validation APIs. Can someone please provide me the appropriate usage in case I am not doing it correctly?

Thanks & Regards,
Keya

© Stack Overflow or respective owner

Related posts about java

Related posts about xml-validation