[xsd-users] Streaming

Boris Kolpackov boris at codesynthesis.com
Thu May 17 09:38:01 EDT 2007


Hi Vincent,

Vincent Jacques <vincent at vincent-jacques.net> writes:

> Since I do need to process a tag as soon as it is finished, I've tried
> to read only 1 byte each time Xerces request, and it works exactly as I
> was expecting.
>
> I'll write a "fast_std_input_source" and use the method document::parse
> which takes a xercesc::InputSource&.
>
> I'm aware that it would not be efficient on big documents, but mine will
> stay small enought.

You can make it a bit more efficient by asking the underlying buffer
for how much data is available to read and using that value instead
of just 1 byte. The way to get this value is by calling the in_avail()
function on the streambuf object associated with the stream:

istream& is = ...
streamsize n = is.rdbuf ()->in_avail ();


hth,
-boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 652 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20070517/9a949314/attachment.pgp


More information about the xsd-users mailing list