[xsd-users] Streaming

Vincent Jacques vincent at vincent-jacques.net
Wed May 16 17:47:41 EDT 2007


Boris Kolpackov a écrit :
> Vincent Jacques <vincent at vincent-jacques.net> writes:

>> Basicaly, my xml document will come from a std::istream and I'm testing
>> with std::cin for the moment. I use the xml_schema::document::parse
>> method which takes a std::istream.

>> My problem is that I have to close the stream (with Ctrl+D under Linux)
>> before any parse event is trigered.

> This is most likely because the underlying parser (Xerces-C++ in this
> case) tries to read a chunk of data that is bigger than your document.

> If you are interested, the code that ties
> std::istream and the Xerces-C++ stream is in
> libxsd/xsd/cxx/xml/sax/std-input-source.hxx.

> One way to test that streaming works on small documents is to
> change the readByte implementation and always read, say, 64
> bytes instead of what Xerces-C++ asks in the 'size' argument.

Marvelous, many thanks :)

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.

Thanks again. I'll come back soon with my next question...

PS : I'm on the mailling list, so you can respond only on the list.
-- 
Vincent Jacques

"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème"
         Devise Shadok




More information about the xsd-users mailing list