| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 1 | |
Hi XML users, I made several tests (10 megabytes XML files) to compare SAX (QXmlDefaultHandler) and stream parsers (QXmlStreamReader). It turns out that the stream parser is 4 times faster than the SAX parser. This is exciting. Also, the stream parser has big advantage of knowing the parsing process by lineNumber(), columnNumber(), and characterOffset(), which can be used to drive a progress bar or error tracking. At the moment of making decision of switching from SAX to stream parsers, I wonder if there is any drawback of the stream parser. Please share your XML parsing experience. Thanks, Lingfa -- [ signature omitted ]
On Tue, Feb 05, 2008 at 03:44:36PM -0500, Lingfa Yang wrote: > Hi XML users, > > At the moment of making decision of switching from SAX to stream > parsers, I wonder if there is any drawback of the stream parser. > Please share your XML parsing experience. > Hi. I've tried both parsers. StreamReader is easier to use if your XML source is QIODevice. Also it allows recursive document parsing. No drawbacks was detected except rewriting parser :) -- [ signature omitted ]
Attachment:
signature.asc
Description: Digital signature
Dmitry Nezhevenko wrote: > On Tue, Feb 05, 2008 at 03:44:36PM -0500, Lingfa Yang wrote: > >> Hi XML users, >> >> At the moment of making decision of switching from SAX to stream >> parsers, I wonder if there is any drawback of the stream parser. >> Please share your XML parsing experience. >> >> > > Hi. I've tried both parsers. StreamReader is easier to use if your XML > source is QIODevice. > > Also it allows recursive document parsing. > > No drawbacks was detected except rewriting parser :) > Dmitry, Yes. I like the recursive feature too. My XML source are QFile or QByteArray types which can be treated as QIODevice. Thanks for your reply, Regards, Lingfa -- [ signature omitted ]
QXmlStreamParser rocks. I succesfully implemeted it for two applications, and this was very simple. In each case I streamed gzipped xml data from a QHttp request, decompressed it on the fly (using a custom QIODevice, as QtIOCompressor is for commercial licenses only), and parsed it through QXmlStreamReader. I tried also with DOM and SAX, both provided heavier code and no stream (recursive) capabilities Etienne
Etienne Sandrà wrote: > QXmlStreamParser rocks. I succesfully implemeted it for two > applications, and this was very simple. In each case I streamed > gzipped xml data from a QHttp request, decompressed it on the fly > (using a custom QIODevice, as QtIOCompressor is for commercial > licenses only), and parsed it through QXmlStreamReader. I tried also > with DOM and SAX, both provided heavier code and no stream (recursive) > capabilities > > Etienne Excellent! Part of my source XML are from Office Open Xml (docx, pptx, and xlsx). I pull tokens from them by using QuaZip, a Qt wrapper around zlib. I like QXmlStreamReader. Does the stream writer help? I use QTextStream instead, which looks fine. Regards, Lingfa -- [ signature omitted ]