mvolkmann / waxy

WAX - a new approach to writing XML
http://java.ociweb.com/mark/programming/wax.html
2 stars 0 forks source link

bug in namespace(String, String, String) #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Was looking WAX.java, I think namespace(String, String, String) has a bug.
Line 460 reads:

// Verify that the prefix isn't already defined in the current scope.
        if (isInScopePrefix(prefix)) {
            throw new IllegalArgumentException(
                "The namespace prefix \"" + prefix + "\" is already in
scope.");
        }

If I understand this correctly, it does not allow namespaces already in
scope to be overridden, although this is perfectly legal in XML. For example

<foo:bar xmlns:foo="ns1">
   <foo:bar xmlns:foo="ns2" />
</foo>

is perfectly well-formed. Once the qnames are expanded by the parser, the
two bar elements are just different.

Original issue reported on code.google.com by manosbat...@gmail.com on 20 Sep 2008 at 3:20

GoogleCodeExporter commented 9 years ago

Original comment by manosbat...@gmail.com on 20 Sep 2008 at 4:57

GoogleCodeExporter commented 9 years ago
Right you are! I'll fix this in the Java version and add a unit test for it ... 
in the opposite order of course. ;-)

Original comment by r.mark.v...@gmail.com on 21 Sep 2008 at 2:12

GoogleCodeExporter commented 9 years ago
I fixed the error checking to only throw an exception if a duplicate namespace 
prefix or duplicate default 
namespace definition appears on the same element. These are now allowed in the 
same scope though.

Original comment by r.mark.v...@gmail.com on 21 Sep 2008 at 1:58