[xsde-users] Parsing a TCP stream

Boris Kolpackov boris at codesynthesis.com
Thu Jan 16 07:26:42 EST 2014


Hi Jonathan,

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

> I am looking for some tools that will parse a TCP stream into full XML
> documents. I have searched online and found that some use the boost::asio
> libraries.
> 
> I thought would ask here what the recommended tools are.

I don't think there could be a single "recommended" way to do this. It
all depends on your requirements. For some application using raw sockets
could be a perfectly reasonable approach. While other may requires
something as involved as ASIO. Generally, I think it has much more
to do with the kind of communication you will be doing: multiple
sockets or single socket, single/multithread-handling of connections,
blocking/non-blocking/asynchronous I/O, etc.

As a generally guide, I would suggest that you keep it simple, at
least at the beginning (e.g., blocking raw socket).


> Bottom line is I am receiving XML documents from a TCP socket and
> need to know where one document ends and another begins. Is there a
> way to automatically do this using things built into XSD/e?

No, there is no automatic (more like auto-magical) way.


> If not, what is the best way to go about doing that?

In XML, NULL ('\0', U+0000) is an invalid character (both in XML 1.0
and 1.1) which makes it a convenient document delimiter.

Boris



More information about the xsde-users mailing list