Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Element.setNamespace() can produce Namespace Conflicts #48

Closed
rolfl opened this Issue · 0 comments

1 participant

@rolfl
Collaborator

Namespace Conflicts happen when a Namespace is introduced that has the same prefix, but different URI as an existing Namespace.

For example, the following is illegal:

        Namespace nsa = Namespace.getNamespace("pfx","URIA");
        Namespace nsb = Namespace.getNamespace("pfx","URIB");

        Element emt = new Element("emt", nsa);
        emt.addNamespaceDeclaration(nsb); // should fail, and it *does*

but, the reverse should be true too, but it isn't:

        Namespace nsa = Namespace.getNamespace("pfx","URIA");
        Namespace nsb = Namespace.getNamespace("pfx","URIB");

        Element emt = new Element("emt");
        emt.addNamespaceDeclaration(nsb);
        emt.setNamespace(nsa);  // should fail, but does not.
@rolfl rolfl closed this issue from a commit
@rolfl rolfl Fixes #48 - Element.setNamespace() does not check for Namespace
Collisions.
Add bunch of JavaDoc to Element
Optimize the addNamespaceDeclaration a little bit.
Add tests to validate the fix
Increase test coverage for a few other things too.
c2167d7
@rolfl rolfl closed this in c2167d7
@rolfl rolfl referenced this issue from a commit
@rolfl rolfl Backport fixes for issue #48 and issue #2 from JDOM2
Bring back a bunch of JDOM2 jUnit test cases too to check the fixes.
6ee1279
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.