What exactly is the problem?
If your XML file contains more information that the two strings, and you want to update those strings and leave the rest of the document unchanged, then use QDomDocument as others have already explained.
If you only care about those two strings and just want to write a new XML file with only those two strings (thus losing any existing additional content), then you can simply write it with QXmlStreamWriter. It improves over your current solution because it properly escapes the two strings.
Bookmarks