Try setting an InputSource as the schemaSource, please see below.

SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);

URL url = getClass().getResource("/test.xsd");
InputSource source = new InputSource(url.openStream());
source.setSystemId(url.toString());

SAXParser parser = factory.newSAXParser();
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage";,
    "http://www.w3.org/2001/XMLSchema";);
parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource";,
source);

SAXReader reader = new SAXReader(parser.getXMLReader(), true);
reader.read("test.xml");

Regards,
Edwin
-- 
http://www.edankert.com/

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to