it is closed source,
but if someone wants to implement pulling / pushing on top of xercesc,
these interfaces are one way to implement the event queue / serialization.
regards
tobias
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, June 18, 2008 5:11 PM
Subject: RE: pull parser
Hello Tobias,
Would you mind posting some example source of each?
Thanks,
Nicholas
-----Original Message-----
From: Tobias [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 18, 2008 1:03 AM
To: [email protected]
Subject: Re: pull parser
I've implemented a pull parser on top of xercesc's internal XMLScanner
interface and
a corresponding push-based writer by using XMLFormatter.
It's quite simple to implement pulling by using an event queue,
getting the various read...-methods right was the laborious task.
regards
tobias
----- Original Message -----
From: "Boris Kolpackov" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, June 17, 2008 11:02 PM
Subject: Re: pull parser
David Bertoni <[EMAIL PROTECTED]> writes:
You can try the "progressive" parsing APIs, which report SAX events
incrementally. See:
SAX2XMLReader::parseFirst()
SAX2XMLReader::parseNext()
However, there is no control over the granularity of the parsing, so
you
should test to make sure what it produces will work for you.
Interesting. I didn't know about this API. Looking at the
documentation
it says that each call to parseNext() covers just one XML token (as
defined by the spec). Based on this it should be pretty straight-
forward to implement a custom pull parser on top of SAX2XMLReader,
e.g., something along these lines:
- Have a queue of events.
- When SAX handlers are called they add corresponding events to the
queue.
- When the user calls next(), the parser check if the queue is empty.
If it is the parser calls parseNext and the handlers add some
event(s)
to the queue with the first one then returned to the user.
Boris
--
Boris Kolpackov, Code Synthesis Tools
http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:
http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing:
http://codesynthesis.com/products/xsde