Hi,
I wanna to open a xml file and update or add some elements and node into it. I've approximately done this but the problem is that it's not updating and add updated stream in end of xml file.
I think i must clear previous stream or file and then save it but i don't know how..
Here is my code:
In the meanwhile how can i clear a text file??!!!
Qt Code:
return false; if(!doc.setContent(&file)); { file.close(); return false; } //Parse XML Document //finding an element QDomElement dialsElement; dialsElement = docElem.elementsByTagName("GaugeComponents").at(0).toElement().elementsByTagName("Dials").at(0).toElement(); //creating some elements x_dialElement.setNodeValue("hello"); dialElement.appendChild(x_dialElement); dialsElement.appendChild(dialElement); doc.save(out,0); file.close();To copy to clipboard, switch view to plain text mode
Bookmarks