I have an QXmlStreamWriter and add some xml to it. It works the first time okay, but it doesn't work when I want to use it to add text to the end of a fi开发者_Go百科le.
The result I got is the first few lines of good and formatted xml, and the second part containing everything on one line.
How do I fix this?
Use following code if you see all the XML file in one line. (I think you mean you get all the file in one line.)
QXmlStreamWriter stream(&file);
stream.setAutoFormatting(true);
stream.setAutoFormattingIndent(2);
精彩评论