Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.6-beta-2
-
Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
-
Component/s: XML Processing
-
Labels:None
-
Environment:Windows XP
-
Number of attachments :
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>
Activity
Paul King
made changes -
| Field | Original Value | New Value |
|---|---|---|
| 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> |
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. {code} 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() {code} Output is (note missing declaration for namespace prefix f:) {noformat} <Foo xmlns="urn:a"> <f:Bar> <haha xmlns="urn:b"/> </f:Bar> </Foo> {noformat} |
Paul King
made changes -
| Assignee | Paul King [ paulk_asert ] |
Paul King
made changes -
| Fix Version/s | 1.6-rc-1 [ 14009 ] | |
| Summary | XmlNodePointer does not handle namespace prefixes | XmlNodePointer does not handle namespace prefixes with repeated URNs |
| Fix Version/s | 1.7-beta-1 [ 14014 ] |
Paul King
made changes -
| Resolution | Fixed [ 1 ] | |
| Fix Version/s | 1.5.8 [ 14630 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |