Hi @kishore_hemmady,
its not getting written into the XML ... in my XML still the old value is present.
I assume you mean its not getting written into the XML file. XML itself is a language, and DOM is an object model representing the data described by the language (in this case, parsed into RAM). If you the the changes to the DOM reflected back to an XML file somewhere, you need to write it out yourself. Its not hard to do though, for example:
QFile file("file.xml");
// Load the XML content from file into a DOM document.
file.open(QFile::ReadOnly);
QDomDocument dom;
dom.setContent(&file);
file.close();
// Change the DOM in memory.
dom.elementsByTagName("Height").at(0).firstChild().setNodeValue("500");
// Write the DOM as XML content back to the file.
file.open(QFile::WriteOnly);
file.write(dom.toByteArray(1));
file.close();
Of course, you should do error checking, and probably backup the file before re-writing it.
For the example above, a diff of the file.xml file before and after looks like:
--- file.xml 2018-03-05 18:07:36.638367812 +1100
+++ file.xml 2018-03-05 18:11:32.357453075 +1100
@@ -2,7 +2,7 @@
<child1>
<Content>Video</Content>
<ZoneNumber>4</ZoneNumber>
- <Height>400</Height>
+ <Height>500</Height>
<Width>600</Width>
</child1>
</main>
Cheers.