开发者

Using QXmlStreamWriter to add text at end of file

开发者 https://www.devze.com 2023-01-04 07:47 出处:网络
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.

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消