{
String errMessage = "Error: JAXP DocumentBuilderFactory attribute not recognized: "
+ JAXP_SCHEMA_LANGUAGE
+ "\n"
+ "Check to see if parser conforms to JAXP 1.2 spec.";
throw new WSIException(errMessage, e);
}
factory.setAttribute(JAXP_SCHEMA_SOURCE, new InputSource(schema));
// Parse the document
DocumentBuilder builder = factory.newDocumentBuilder();
builder.setErrorHandler(new ErrHandler());
doc = builder.parse(inputSource);
// workaround for compatibility Xerces 2.2.1 with Xerces 2.6.2,
// Xerces 2.6.2 supported XML 1.1 but WSI-tool and Xerces 2.2.1
// supported only XML 1.0
if (doc instanceof org.apache.xerces.dom.DocumentImpl)
{
if (((org.apache.xerces.dom.DocumentImpl) doc).getXmlVersion().equals("1.1"))
{
throw new WSIException("Fatal Error: XML version "1.1" "
+ "is not supported, only XML 1.0 is supported.");
}
}
}
catch (Exception e)
{
throw new WSIException("Could not parse XML document.", e);
}
finally
{
Thread.currentThread().setContextClassLoader(currentLoader);
}