/**
     * Validate a document against an IEPD. Note that this does not require the xsi namespace location attributes to be set in the instance.
     * 
     * @param schemaPathList
     *            the paths to all schemas necessary to validate the instance; this is the equivalent of specifying these schemas in an xsi:schemaLocation attribute in the instance
     *                       
     * @param Never_Used_TODO_Remove 
     * 
     *            
     * @param rootSchemaFileName
     *            the name of the document/exchange schema
     * @param d
     *            the document to validate
     * @param iepdResourceResolver
     *            the resource resolver to use
     * @return the document that was validated
     * @throws Exception
     *             if the document is not valid
     */
public static void validateInstance(Document d, LSResourceResolver iepdResourceResolver, List<String> schemaPathList) throws SAXException, Exception {
		SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        schemaFactory.setResourceResolver(iepdResourceResolver);
        List<Source> sourceList = new ArrayList<Source>();
        for (String schemaPath : schemaPathList) {
        	InputStream schemaInStream = XmlUtils.class.getClassLoader().getResourceAsStream(schemaPath);
        	StreamSource schemaStreamSource = new StreamSource(schemaInStream);
        	sourceList.add(schemaStreamSource);        	
        }
        Source[] schemaSourcesArray = sourceList.toArray(new Source[]{});
        try {        	
            Schema schema = schemaFactory.newSchema(schemaSourcesArray);        
            Validator validator = schema.newValidator();
            validator.validate(new DOMSource(d));
        } catch (Exception e) {
            try {
                e.printStackTrace();
                System.err.println("Input document:");
                XmlUtils.printNode(d);
            } catch (Exception e1) {
                e1.printStackTrace();
            }
            throw e;
        }
	}
public static void validateInstance(Document d, LSResourceResolver iepdResourceResolver, List<String> schemaPathList) throws SAXException, Exception {
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFactory.setResourceResolver(iepdResourceResolver);
List<Source> sourceList = new ArrayList<Source>();
for (String schemaPath : schemaPathList) {
InputStream schemaInStream = XmlUtils.class.getClassLoader().getResourceAsStream(schemaPath);
StreamSource schemaStreamSource = new StreamSource(schemaInStream);
sourceList.add(schemaStreamSource);
}
Source[] schemaSourcesArray = sourceList.toArray(new Source[]{});
try {
Schema schema = schemaFactory.newSchema(schemaSourcesArray);
Validator validator = schema.newValidator();
validator.validate(new DOMSource(d));
} catch (Exception e) {
try {
e.printStackTrace();
System.err.println("Input document:");
XmlUtils.printNode(d);
} catch (Exception e1) {
e1.printStackTrace();
}
throw e;
}
}
public static void validateInstance(Document d, LSResourceResolver iepdResourceResolver, List<String> schemaPathList) throws SAXException, Exception {
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFactory.setResourceResolver(iepdResourceResolver);
List<Source> sourceList = new ArrayList<Source>();
for (String schemaPath : schemaPathList) {
InputStream schemaInStream = XmlUtils.class.getClassLoader().getResourceAsStream(schemaPath);
StreamSource schemaStreamSource = new StreamSource(schemaInStream);
sourceList.add(schemaStreamSource);
}
Source[] schemaSourcesArray = sourceList.toArray(new Source[]{});
try {
Schema schema = schemaFactory.newSchema(schemaSourcesArray);
Validator validator = schema.newValidator();
validator.validate(new DOMSource(d));
} catch (Exception e) {
try {
e.printStackTrace();
System.err.println("Input document:");
XmlUtils.printNode(d);
} catch (Exception e1) {
e1.printStackTrace();
}
throw e;
}
}
public static void validateInstance(Document d, LSResourceResolver iepdResourceResolver, List<String> schemaPathList) throws SAXException, Exception {
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFactory.setResourceResolver(iepdResourceResolver);
List<Source> sourceList = new ArrayList<Source>();
for (String schemaPath : schemaPathList) {
InputStream schemaInStream = XmlUtils.class.getClassLoader().getResourceAsStream(schemaPath);
StreamSource schemaStreamSource = new StreamSource(schemaInStream);
sourceList.add(schemaStreamSource);
}
Source[] schemaSourcesArray = sourceList.toArray(new Source[]{});
try {
Schema schema = schemaFactory.newSchema(schemaSourcesArray);
Validator validator = schema.newValidator();
validator.validate(new DOMSource(d));
} catch (Exception e) {
try {
e.printStackTrace();
System.err.println("Input document:");
XmlUtils.printNode(d);
} catch (Exception e1) {
e1.printStackTrace();
}
throw e;
}
}