PDA

View Full Version : async xml parsing



invictus
18th December 2007, 14:19
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.

wysota
18th December 2007, 16:31
Take a look at QXmlReader and friends.

invictus
18th December 2007, 18:10
So its basically SAX that is my options?

wysota
18th December 2007, 20:18
You can use QXmlStreamReader as well. They say it's easier to use.

invictus
18th December 2007, 23:27
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.

invictus
20th December 2007, 09:32
Take a look at QXmlReader and friends.

Btw, if I do use SAX, wont that block the event-thread until parsing is complete?

wysota
20th December 2007, 09:36
If you don't parse the whole file at once, it shouldn't.