I'm trying to read existing xml file, that has duplicated namespace declarations. It is important to me to leave this declarations for further processing. Earlier I was using XERCES implementation of org.w3c.dom api to read such a documents, and all declarations left, but when I started to use JDOM, it started to omit redundant namespace declarations.
Here is the sample xml file:
<?xml version="1.0" encoding="UTF-8"?>
I'm building JDOM Document with this code:
SAXBuilder builder = new SAXBuilder();
File inputXml = new File(inputFile);
jdomInDoc = builder.build(inputXml);
Is there any way to force JDOM not to omit redundant namespace declarations?
Thank you in advance for yor answers.
Right, I have investigated this issue, and decided it is too intrusive to implement.... I cannot keep backward compatibility.
The issues on input handling are:
As for output handling:
The bottom line is that backward compatibility will be compromised, almost all the input/output classes in JDOM will need to be 'touched' to make it work. The value of the feature is very marginal.
In the balance, it is not appropriate to implement this feature (at this point.... probably not in the 2.x cycle at all ... in other words, don't expect this to change)