0

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,

Jijo AC
  • 23
  • 6
  • You should edit the relevant parts of your xml and xsd into your question to be able to diagnose the problem, but maybe the issue is something like https://stackoverflow.com/a/50535565/? – Marijn Apr 16 '23 at 11:04

0 Answers0