Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, March 2008
QXmlStreamReader state engine


Message 1 in thread

Hi,
so i thought it wouldnt kill me to start a nested eventloop. well,... remeber 
xkcd commic with the guy who uses goto and gets eaten by a dinosour.  yes 
using a second eventloop was a damn stupid idea. now if you start two 
instances of the reader one will stack on the other and block the others 
loop. 
So back to the basics. 

QXmlStreamReader is suposed to recover from EOF. unfortunatly there is no way 
to safe the parser state when leaving the recursion. And you _have to_ leave 
the recursion so the mainloop gets controll back, so the socket can read data 
again. I tried saving the state by just not leaving the recursion. basicly i 
abuse the stack memory as state engine. seems like a bad idea. 
any other ideas are welcome.
Write a state engine? yeah, but how do you get back to the last parser 
function? function pointers? *shudder*
I also though about waiting for the last element to be closed and then fire 
the parser, but thats so ugly. It would break subevents. (yes, events, i'm 
actually "abusing" the sax event parser for events instead of files)
If you where about to recommend threads, just don't answer. thanks.
-- 
 [ signature omitted ]