title: Retrieve a whole node as a string with XmlSlurper
body: <p>I want to retrieve the elements of <code>&lt;logs&gt;</code> as array of <code>String</code> and I am trying the following:</p>
  
  <pre><code>import groovy.util.XmlSlurper
  
  def payload = '''&lt;logs&gt;
  &lt;log&gt;
    &lt;text&gt;LOG 1&lt;/text&gt;
    &lt;timestamp&gt;2017-05-18T16:20:00.000&lt;/timestamp&gt;
  &lt;/log&gt;
  &lt;log&gt;
    &lt;text&gt;LOG 2&lt;/text&gt;
    &lt;timestamp&gt;2017-05-18T16:20:00.000&lt;/timestamp&gt;
  &lt;/log&gt;
  &lt;/logs&gt;'''
  
  def logs = new XmlSlurper().parseText(payload)
  def result = []
  logs.log.each{
    result.add(it)
  }
  result
  </code></pre>
  
  <p>​However, I am getting the values, but I would like to get the whole node as text, more or less this:</p>
  
  <pre><code>[&lt;log&gt;
    &lt;text&gt;LOG 1&lt;/text&gt;
    &lt;timestamp&gt;2017-05-18T16:20:00.000&lt;/timestamp&gt;
  &lt;/log&gt;,
  &lt;log&gt;
    &lt;text&gt;LOG 2&lt;/text&gt;
    &lt;timestamp&gt;2017-05-18T16:20:00.000&lt;/timestamp&gt;
  &lt;/log&gt;]
  </code></pre>
  
  <p>Is this at all possible with <code>XmlSlurper</code> or should I use some String operations?</p>