title: LibXML: After Changing a node's text content to null, like to return abbreviated node
body: <p>After I set a node that original contained some data value, I'd like for this node with an empty/null text value to be in the abbreviated form:</p>
  
  <p>With text:</p>
  
  <pre><code>&lt;frog&gt;green&lt;/frog&gt; 
  </code></pre>
  
  <p>Abbreviated form:</p>
  
  <pre><code>&lt;frog/&gt;
  </code></pre>
  
  <p>Current code:</p>
  
  <pre><code> foreach my $child ($node-&gt;getChildnodes())
      {
       if ($child-&gt;nodeType == XML_TEXT_NODE)
       {
        my $data = $child-&gt;getData();
        $data =~ s/(?$case_flag)$sv/$rv/g;
        $child-&gt;setData ($data);
        #my $xyz = $parser-&gt;parse_balanced_chunk ($node-&gt;toString(0))-&gt;toString(0);
       }
      }
  </code></pre>
  
  <p>The commented-out line returns what I want, but I can't get this back into the document with the abbreviated tag.</p>