title: Replace an existing xml tag value occurs unexpected change in xml file
body: <p>I want to replace a value of a xml tag. I can replace the value by using QDom, however I am getting a change in my xml file just after that change. </p>
  
  <p>I am working with qt and I have tried with "QDOM" to replace the tag value and save it using "QTextStream".</p>
  
  <pre><code>QFile myFile(QLatin1String(my_FILE));
  if (liceFile.open(QIODevice::ReadWrite)) {
      QDomDocument doc;
      doc.setContent(&amp;myFile);
      QDomElement parentEle = doc.firstChildElement("Root");
      QDomNode myValue= parentEle.firstChildElement("Mytag");
      myValue.firstChild().setNodeValue("Hey");
      QTextStream stream(&amp;myFile);
      doc.save(stream, 4);
      myFile.close();
  </code></pre>
  
  <p>The xml file:</p>
  
  <pre><code>"&lt;Root&gt;
     &lt;Mytag&gt;Hello&lt;/Mytag&gt;
     &lt;User&gt;&lt;/User&gt;
     &lt;Pass&gt;121&lt;/Pass&gt;"
  </code></pre>
  
  <p>If I replacing  the value of "Mytag". 
      Output after replace.</p>
  
  <pre><code>"&lt;Root&gt;
    &lt;Mytag&gt;Hey&lt;/Mytag&gt;
    &lt;User/&gt;
    &lt;Pass&gt;121&lt;/Pass&gt;" 
  </code></pre>
  
  <p>I can not understand why  tag changed from <code>&lt;User&gt;Mr&lt;User/&gt;</code> to   <code>&lt;User/&gt;</code></p>