PDA

View Full Version : Xml stream



rk0747
8th February 2010, 06:19
hi,
I am using xmlstreamreader and xmlstreamwriter to save the read the data. now i want to edited and update the data.
Is this possibe with xmlstream ? Is there feature in XMl Stream?

high_flyer
9th February 2010, 09:01
Personally I havn't done any XML with Qt sofar, but from the looks of it, you might want to have a look at QDomDocument and the examples there.

faldzip
9th February 2010, 11:05
XMLStream reader and writer are nice for reading document from string and writing it back. For editing xml it is better to use QDomDocument, which loads whole XML into memory as its own data structure which you can traverse and modify with QDom classes and methods. Then after modifications you can write it back.

pitonyak
9th February 2010, 18:10
Using DOM, you can load the entire XML into memory at one time, make changes, then write the changes back. If you use a stream, then I suppose that while you are reading the text, you write the unchanged portion until you arrive at the portion that should be changed, write the changed section, then write the rest.

Which you use is directly related to the method that works best for how you work. If you intend to read the entire thing into memory before writing, DOM feels like the better choice.