title: How to remove a child node from an XML file in C++ using Xerces-C?
body: <pre><code>    root = doc-&gt;getDocumentElement();
      child=root-&gt;getLastChild();
  
      DOMNode* removedElement = root-&gt;removeChild(child);
      removedElement-&gt;release();
  </code></pre>
  
  <p>The child is getting newline character as a node if the XML file is like this:</p>
  
  <pre><code>     &lt;root&gt;
           &lt;child1&gt; &lt;/child1&gt;
           &lt;child2&gt; text &lt;/child2&gt;
        &lt;/root&gt;
  </code></pre>
  
  <p>The same code is working fine and removing child if the XML file is of the format</p>
  
  <pre><code>     &lt;root&gt; &lt;child1&gt;&lt;/child1&gt;&lt;child2&gt;text&lt;/child2&gt; &lt;/root&gt;
  </code></pre>
  
  <p>How can I get rid of it (the newline)?</p>