title: QDomNode Class read value of child in qt
body: <p>I want to change "A" in Apple, in key which value is 1 to "D", in this code 2 items should be replaced. I tried something like this, but nothing happens.</p>
  
  <pre><code> &lt;C&gt;
      &lt;B&gt;  
      &lt;Key value="1"&gt;
         &lt;Apple&gt;A&lt;/Apple&gt;
      &lt;/Key&gt;
      &lt;Key value="2"&gt;
         &lt;Apple&gt;A&lt;/Apple&gt;
      &lt;/Key&gt;
      &lt;Key value="3"&gt;
         &lt;Apple&gt;A&lt;/Apple&gt;
      &lt;/Key&gt;
      &lt;Key value="1"&gt;
         &lt;Apple&gt;A&lt;/Apple&gt;
      &lt;/Key&gt;
      &lt;/B&gt;
   &lt;/C&gt; 
  </code></pre>
  
  <p>Qt:</p>
  
  <pre><code>QDomNodeList roots = doc.elementsByTagName("Key");
  
  for (int i = 0; i &lt; roots.size(); ++i) {
      QDomElement domElement = roots.at(i).toElement();
      QDomAttr attribute = domElement.attributeNode("value");
      if (attribute.value() == "1") { 
          domElement.firstChild().setNodeValue("D");
      }
  </code></pre>