If you want to use schemas such as :
When you create the document factory you have to tell it to become namespace aware :
static final String JAXP_SCHEMA_LANGUAGE =
“http://java.sun.com/xml/jaxp/properties/schemaLanguage”;
static final String W3C_XML_SCHEMA =
“http://www.w3.org/2001/XMLSchema”;
try {
factory.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
}
catch (IllegalArgumentException x) {
// Happens if the parser does not support JAXP 1.2
throw new XMLValidationException(“Could not create validating XML Parser ” + x.getMessage(), x);
}
THis lets it understand, otherwise you get :
org.xml.sax.SAXParseException: Document is invalid: no grammar found.
org.xml.sax.SAXParseException: Document root element “EClaim_Message”, must match DOCTYPE root “null”.