XMLMessages.SCHEMA_GENERIC_ERROR, e.getMessage() );
}
Document document = fSchemaGrammarParser.getDocument(); //Our Grammar
TraverseSchema tst = null;
try {
if (DEBUG_SCHEMA_VALIDATION) {
System.out.println("I am geting the Schema Document");
}
Element root = null;
if (document != null) {
root = document.getDocumentElement();// This is what we pass to TraverserSchema
}
if (root == null) {
reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Can't get back Schema document's root element :" + loc);
} else {
if (uri == null || !uri.equals(root.getAttribute(SchemaSymbols.ATT_TARGETNAMESPACE)) ) {
reportRecoverableXMLError(XMLMessages.MSG_GENERIC_SCHEMA_ERROR, XMLMessages.SCHEMA_GENERIC_ERROR, "Schema in " + loc + " has a different target namespace " +
"from the one specified in the instance document :" + uri);
}
grammar = new SchemaGrammar();
grammar.setGrammarDocument(document);
// Since we've just constructed a schema grammar, we should make sure we know what we've done.
fGrammarIsSchemaGrammar = true;
fGrammarIsDTDGrammar = false;
//At this point we should expand the registry table.
// pass parser's entity resolver (local Resolver), which also has reference to user's
// entity resolver, and also can fall-back to entityhandler's expandSystemId()
tst = new TraverseSchema( root, fStringPool, (SchemaGrammar)grammar, fGrammarResolver, fErrorReporter, source.getSystemId(), currentER, getSchemaFullCheckingEnabled());
//allowing xsi:schemaLocation to appear on any element
String targetNS = root.getAttribute("targetNamespace");
fGrammarNameSpaceIndex = fStringPool.addSymbol(targetNS);
fGrammarResolver.putGrammar(targetNS, grammar);