Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.5.6, 1.6-beta-1
-
None
-
Patch
Description
A previous fix for the XmlNodePrinter escaped special characters within attributes, but not within the value. The printEscaped method should also be called within the value.
import groovy.util.XmlNodePrinter; def doc = """<Root attribute="<"&>"><&></Root>"""; def root = new XmlParser().parseText(doc); def writer = new StringWriter(); new XmlNodePrinter(new PrintWriter(writer)).print(root); println writer.toString();
Originally would produce:
<Root attribute="<"&>">
<&>
</Root>
After patch, produces: