Results 1 to 7 of 7

Thread: async xml parsing

  1. #1
    Join Date
    Feb 2007
    Posts
    61
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default async xml parsing

    Hi

    What is the best method for parsing XML (from a socket) without blocking the main event loop? Threads, or is there any good way to hook XML parsing into the main loop?

    I read on the trolltech blog once that the SAX parser API was a piece of shit (although with other words), and I believe that the XmlReader thingy is blocking the loop.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: async xml parsing

    Take a look at QXmlReader and friends.

  3. #3
    Join Date
    Feb 2007
    Posts
    61
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: async xml parsing

    So its basically SAX that is my options?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: async xml parsing

    You can use QXmlStreamReader as well. They say it's easier to use.

  5. #5
    Join Date
    Feb 2007
    Posts
    61
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: async xml parsing

    Yeah, but won't that lead to blocking code?

    UPDATE: I just read the docs in detail and saw that that isn't the case.

  6. #6
    Join Date
    Feb 2007
    Posts
    61
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: async xml parsing

    Quote Originally Posted by wysota View Post
    Take a look at QXmlReader and friends.
    Btw, if I do use SAX, wont that block the event-thread until parsing is complete?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: async xml parsing

    If you don't parse the whole file at once, it shouldn't.

Similar Threads

  1. Parsing Files
    By JayJay in forum Qt Programming
    Replies: 13
    Last Post: 20th August 2007, 19:01
  2. XML Parsing in Qt 3.3
    By ToddAtWSU in forum Qt Programming
    Replies: 5
    Last Post: 18th April 2007, 18:54
  3. Config file parsing
    By Vash5556 in forum Qt Programming
    Replies: 2
    Last Post: 10th September 2006, 23:11
  4. using postEvent, but still getting async error
    By ender in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2006, 17:15
  5. HTML Parsing
    By awalesminfo in forum Qt Programming
    Replies: 3
    Last Post: 19th March 2006, 11:31

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
  •  
Qt is a trademark of The Qt Company.