I'm using dom4j to parse XML files on line.
File file = new File("text.xml");
SAXReader reader = new SAXReader();
Document document = reader.read(file);
There is a syntax error in some XML files, which make the program throw SAXParseException: The prefix X for element X:A is not bound
at line reader.read(file)
.
I know what the error is, and how to make the XML files right. Just as what said in this article
But the problem is the XML file is uploaded by users, I can not change the file before parse it, and I can not ask the user to change the XML file.
So, is there a way to parse the xml file with a undefined prefix error exist?