SAXReader read() method throws org.dom4j.DocumentException when update from dom4j 1.6.1 to 2.0.3

175 Views Asked by At

We updated dom4j from 1.6.1 to 2.0.3, Now we are getting following exception in parsing xml file

Our code is

SAXParser parser = factory.newSAXParser();
final SAXReader reader = new SAXReader(parser.getXMLReader());
reader.setValidation(false);
final InputSource source = new InputSource(new ByteArrayInputStream(xmlData));
final Document document = reader.read(source);

Error is

Error parsing xml data; nested exception is org.dom4j.DocumentException: Error on line 3 of document  : cvc-elt.1: Cannot find the declaration of element 'users'. org.springframework.dao.DataIntegrityViolationException: Error parsing xml data; nested exception is org.dom4j.DocumentException: Error on line 3 of document  : cvc-elt.1: Cannot find the declaration of element 'users'.
    
Caused by: org.dom4j.DocumentException: Error on line 3 of document  : cvc-elt.1: Cannot find the declaration of element 'users'.
    at org.dom4j.io.SAXReader.read(SAXReader.java:511)
    

We refer text and tried by set saxParserFactory.setFeature("http://xml.org/sax/features/external-general-entities", true); saxParserFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", true);

and also we tried explicitly set all dependencies like Jaxen, xsdlib But nothing Help,

0

There are 0 best solutions below