This project is read-only.

Parsing with the Qt recursive descent parser?

May 30, 2013 at 1:29 PM
Once I have opened a package and a part, can I get access to the raw data as a char*? I am using Qt's QXmlStreamReader to parse content and at the moment I dump the contents of the part to a buffer and then parse that (see - I'd like to skip out the bit where I dump it to the buffer.

I know I can use the mce recursive descent parser, but I have all this code already written... does LibOPC expose a char* buffer for a part in any way?
Jun 1, 2013 at 11:21 AM

the underlying XML processing is done by libxml. A quick google search did not reveal any bridges between libxml and QXmlStreamReader.
You can get the "char *" buffer which is used as libxml's input stream, however the MCE processing is done on the libxml layer.
So is there something like a QXmlSaxFilter?? I mean something which takes SAX or even better XmlReader events as input? That way you can bridge the two.

Another possible options: It is possible to write your own QXmlInputSource on to of libopcs mce stuff.

Hope this helps,


Jun 4, 2013 at 1:16 AM
Thanks for the reply. libxml and QXmlStreamReader fill the same niche, so I didn't have very high hopes for this.

I have decided to take a different approach: by dumping to a buffer it allows me to parallelise the loading of different parts of the document. The dump has to be sequential because libopc/libxml is not threadsafe, but then the processing of each can be kicked off as soon as the part is dumped. So I'm going to try and do that - sure it's going to take more memory but hopefully it'll give us some other performance benefits.