[xsde-users] Stream oriented parsing

Boris Kolpackov boris at codesynthesis.com
Fri Feb 21 01:15:32 EST 2014


Hi Jonathan,

Jonathan Haws <Jonathan.Haws at sdl.usu.edu> writes:

> I kind of asked this question a while ago, but was doing some more 
> searching online and came across a feature of the XSD/e C++ parser
> - "perform stream-oriented processing".  What exactly does that mean?

That means that you can start processing the data extracted from the
document as it becomes available/being parsed.


> What I have is the XML documents I am receiving are coming over TCP
> sockets, so I am not guaranteed that I will receive an entire document
> on a socket read.  I was hoping I could use this stream-oriented feature
> to handle the TCP stream as its feed.  Does that paradigm work?

Yes. Think of this functionality as having two levels:

1. The first level is where you can feed the parser the document in
   chunks (i.e., memory buffers) until everything is parsed (you
   still need to tell the parser where the document ends thought).
   After the last call to parse() you call post() and get the complete
   in-memory object model for the entire document (for C++/Hybrid). To
   implement this approach, check the overloaded parse() function
   that takes the memory buffer (the guide has an example that
   shows how to use it).

2. The second level is based on the first in that you can still feed
   the parser chunks of your document but now, instead of waiting
   for the entire object model being assembled, the parser feeds
   you chunks of the object model to process. This approach is
   shown in the 'streaming' example for C++/Hybrid.

Boris



More information about the xsde-users mailing list