Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.6-beta-2
-
None
-
Windows XP
Description
There are still problems with the XML Namespace handling of XmlNodePrinter in 1.6 Beta 2. The following code parses valid XML and then writes it out to a string. The string no longer contains valid XML because one of the namespace prefixes has been lost.
def x="<Foo xmlns='urn:a' xmlns:f='urn:a'><f:Bar xmlns='urn:b'><haha/></f:Bar></Foo>" def y = new XmlParser(false, true).parseText(x) def writer = new StringWriter() def xnp = new XmlNodePrinter(new PrintWriter(writer)) xnp.namespaceAware = true xnp.print(y) print writer.toString()
Output is (note missing declaration for namespace prefix f
<Foo xmlns="urn:a"> <f:Bar> <haha xmlns="urn:b"/> </f:Bar> </Foo>