Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.5.7, 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, Java 1.6.0_06
-
Testcase included:yes
-
Patch Submitted:Yes
-
Number of attachments :
Description
The following script fails, because XmlNodePrinter ignores the attribute namespace. The output of writer.toString() is <root
{www.foo.bar}type="foo"/>
def attributeWithNamespaceInput = "<root ns1:type=\"foo\" xmlns:ns1=\"www.foo.bar\"/>\n"
def root = new XmlParser().parseText(attributeWithNamespaceInput)
def writer = new StringWriter()
new XmlNodePrinter(new PrintWriter(writer)).print(root)
assert writer.toString() == attributeWithNamespaceInput
I attached a fix for XmlNodePrinter and updated the corresponding test class.
Hi. Thanks for the patch - looking at it now. Just for future reference, patches against trunk are generally greatly preferred over complete source files. But I guess a file is preferred over nothing!