I have a Groovy script which parses a XML file using XmlParser. And I want to print a Node that contains XML/HTML code (see below).

The XML file look like this:

```
<root>
  <name>myname</name>
  <version>1.0</version>
  <entry>
    <locale>en</locale>
    <rules>
      <rule>
        <pattern>with.html.text</pattern>
        <replace-value><em>emphasis {0}</em> is ok</replace-value>
      </rule>
    </rules>
  </entry>
</root>

```

And I tried something like:

```
StringWriter sw = new StringWriter()
PrintWriter pw = new PrintWriter(sw)
XmlNodePrinter nodePrinter = new XmlNodePrinter(new IndentPrinter(pw,"", false))
root = new XmlParser().parseText(myxml)
allRules = root.'rules'.rule.findAll()
allRules.each { aRule ->
    nodePrinter.print(aRule.'replace-value'[0])
    println sw.toString()
}

```

I expect: `<em>emphasis {0}</em> is ok`

But it prints: `<replace-value><em>emphasis {0}</em>is ok</replace-value>`

How to avoid the `<replace-value>` tag and preserve the space between `</em>` and "is" ?

Thanks for your help

EDIT:
Note that my goal is to transform the XML file into a CSV file.
I updated the XML sample to be more precise. Rules are attached to a locale.
So I need to be able, for each replace-value element, to retrieve for which key and which locale it must be applied.