Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.8.7, 2.0.4, 2.0.6
-
None
-
None
Description
As a result methods that rely on the mapping (e.g. XmlSlurper#lookupNamespace(String)) do not work correctly:
def xml = new XmlSlurper(false, true).parseText('''<root xmlns:tns="urn:first"> <tns:a tns:attr="value"/> <tns:b xmlns:tns="urn:second" attr="value"/> <tns:c attr="value"/> </root>'''); xml.declareNamespace(ns1:'urn:first', ns2:'urn:second') assert xml.'ns1:a'[0].namespaceURI() == "urn:first" // OK assert xml.'ns2:b'[0].namespaceURI() == "urn:second" // OK assert xml.'ns1:c'[0].namespaceURI() == "urn:first" // OK assert xml.'ns1:a'[0].lookupNamespace("tns") == "urn:first" // ERROR assert xml.'ns2:b'[0].lookupNamespace("tns") == "urn:second" // OK assert xml.'ns1:c'[0].lookupNamespace("tns") == "urn:first" // ERROR