Skip to content

Leave explicit namespace declarations in output #83

@rolfl

Description

@rolfl

From http://stackoverflow.com/questions/10597274/leaving-duplicate-namespace-declarations-with-jdom

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"?>
<document xmlns:ns="namespace_uri">
  <element1>...</element1>
  <element2>
    <ns:child>
      text
    </ns:child>
  <element3 xmlns:ns="namespace_uri">
    <ns:child>
      content
    </ns:child>
  </element3>
</document>

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions