A
Andrew Thompson
There are some XML documents that I am attempting to
validate against DTD's, XSD's & most lately, Schematron
and Relax-NG style validation documents.
Although both of the latter are mentioned in the documentation*
of the Java classes, I am having trouble figuring how to get
a Java based validators for either (note that I am most interested
in Schematron, but am attempting Relax-NG first, simply because
it is mentioned more in the JavaDocs, and has a constant to
represent it.
However, this throws exceptions..
<sscce>
import javax.xml.validation.SchemaFactory;
import javax.xml.XMLConstants;
class SchemaFactoryTypes {
public static void main(String[] args) {
SchemaFactory factory = SchemaFactory.newInstance(
XMLConstants.RELAXNG_NS_URI);
}
}
</sscce>
Exception in thread "main" java.lang.IllegalArgumentException:
http://relaxng.org/ns/structure/1.0
at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:186)
at test.SchemaFactoryTypes.main(SchemaFactoryTypes.java:7)
Why is there a constant defined for Relax-NG if the
validator does not understand it?
How do I get a validator for the Schematron files?
*
<http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/package-summary.html>
<http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/XMLConstants.html#RELAXNG_NS_URI>
validate against DTD's, XSD's & most lately, Schematron
and Relax-NG style validation documents.
Although both of the latter are mentioned in the documentation*
of the Java classes, I am having trouble figuring how to get
a Java based validators for either (note that I am most interested
in Schematron, but am attempting Relax-NG first, simply because
it is mentioned more in the JavaDocs, and has a constant to
represent it.
However, this throws exceptions..
<sscce>
import javax.xml.validation.SchemaFactory;
import javax.xml.XMLConstants;
class SchemaFactoryTypes {
public static void main(String[] args) {
SchemaFactory factory = SchemaFactory.newInstance(
XMLConstants.RELAXNG_NS_URI);
}
}
</sscce>
Exception in thread "main" java.lang.IllegalArgumentException:
http://relaxng.org/ns/structure/1.0
at javax.xml.validation.SchemaFactory.newInstance(SchemaFactory.java:186)
at test.SchemaFactoryTypes.main(SchemaFactoryTypes.java:7)
Why is there a constant defined for Relax-NG if the
validator does not understand it?
How do I get a validator for the Schematron files?
*
<http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/package-summary.html>
<http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/XMLConstants.html#RELAXNG_NS_URI>