Results 1 to 4 of 4

Thread: Xml stream

  1. #1
    Join Date
    Jan 2010
    Posts
    28
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Xml stream

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Xml stream

    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.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Xml stream

    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.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  4. #4
    Join Date
    Jan 2010
    Posts
    73
    Thanks
    6
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Xml stream

    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.

Similar Threads

  1. QHttp file upload doesn't stream?
    By haughki in forum Qt Programming
    Replies: 9
    Last Post: 21st October 2009, 20:42
  2. Non-blocking stream read
    By akiross in forum Qt Programming
    Replies: 3
    Last Post: 16th April 2009, 11:07
  3. How can we convert video stream to QPixmap?
    By learning_qt in forum Qt Programming
    Replies: 1
    Last Post: 9th September 2008, 23:44
  4. QGraphicScene to stream
    By phannent in forum Newbie
    Replies: 2
    Last Post: 28th June 2008, 09:43
  5. QFile stream to SDL_mixer
    By doitux in forum Qt Programming
    Replies: 9
    Last Post: 2nd June 2007, 14:56

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.