View Full Version : Writing an XML file
qball2k5
17th March 2006, 20:20
What's the best way to write an XML file?
I tried using QFile and QTextStream...but any time I wanted to add something to the file...it would delete the current data. Is there a way to write to a file and not delete the contents?
I know about QDomDocument....but I'm having some difficultity trying to understand exactly how the formatting goes then getting to a file.
Thanks!
Rob
jacek
17th March 2006, 20:30
In what mode do you open that file?
qball2k5
17th March 2006, 20:37
I ReadWrite
qball2k5
17th March 2006, 20:37
I used ReadWrite? Is that wrong? Should I just use Write? Will that append?
qball2k5
17th March 2006, 21:17
Got it...use Append instead of ReadWrite...thanks!
Xagen
18th March 2006, 16:55
Use QDom or SAX for writing XML files. It is the best way to do it...
drow
19th March 2006, 10:36
Hi,
look here:
http://www.digitalfanatics.org/projects/qt_tutorial/
Bye
dimitri
19th March 2006, 10:47
Use QDom or SAX for writing XML files. It is the best way to do it...
SAX (and to a lesser extent DOM) is more approriate for parsing files, not writing them, QDomDocument::toString (http://doc.trolltech.com/4.1/qdomdocument.html#toString) does help to write a file.
Xagen
19th March 2006, 10:54
SAX (and to a lesser extent DOM) is more approriate for parsing files, not writing them, QDomDocument::toString (http://doc.trolltech.com/4.1/qdomdocument.html#toString) does help to write a file.
Look at the Sax and Dom's examples in the QT distribution...
Chaid
19th March 2006, 10:58
Read the following book:
"Programming with QT3" by J.Blanchette.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.