title: Perl XML::LibXML textContent
body: <p>Is there any way how to keep tags of nodes from xml code? Explanation of the problem could be like this: I have an xml input, I query the input and I want to get xml output of the queried items. </p>
  
  <pre><code>&lt;pets&gt;
    &lt;dog&gt;
      &lt;name&gt;Maggie&lt;/name&gt;
      &lt;dob&gt;12 October 2005&lt;/dob&gt;
      &lt;price&gt;75&lt;/price&gt;
      &lt;owner&gt;Rosie&lt;/owner&gt;
    &lt;/dog&gt;
  &lt;/pets&gt;
  </code></pre>
  
  <p>When I access <code>//pets/dog</code> in my Perl program, the output is as follows:</p>
  
  <pre><code>&lt;?xml version='1.0' standalone='yes'?&gt;
  &lt;dog&gt;
      Maggie
      12 October 2005
      75
      Rosie
  &lt;/dog&gt;
  </code></pre>
  
  <p>Is there any way to give the function <code>textContent</code> some parameter
  to keep the tags? This is a block of my cycle code that puts the nodes
  into hash, then outputs it:</p>
  
  <pre><code>$parser = XML::LibXML-&gt;new();
  $data = $parser-&gt;load_xml(string =&gt; $takeninput);
  $xml = new XML::LibXML::XPathContext($data);
  $i = 0;
  for $node ($xml-&gt;findnodes('//pets/dog'))
    {
      $name = $node-&gt;nodeName;
      $hash{$name}[$i] = $node-&gt;textContent;
      $i++;
    }
  </code></pre>
  
  <p>To <em>keep the tags</em> of children? To have the output like this:</p>
  
  <pre><code>&lt;?xml version='1.0' standalone='yes'?&gt;
  &lt;dog&gt;
      &lt;name&gt;Maggie&lt;/name&gt;
      &lt;dob&gt;12 October 2005&lt;/dob&gt;
      &lt;price&gt;75&lt;/price&gt;
      &lt;owner&gt;Rosie&lt;/owner&gt;
  &lt;/dog&gt;
  </code></pre>
  
  <p>Thank you for answers.</p>