DOM - reading from std::istream?

Hi, my current application framework which I want to make Collada ready uses a self written filemanager which can read from zip files and directories, using std::istream.

I couldn’t find any way how to build a DAE out of a std::istream. Is there a certain reason for the DOM not providing such a way, or is this way somehow not possible due to the general organisation of the DOM?

Is it possible to add such a support in some upcoming dom releases?


@mods: i realized this is in the wrong subforum. please move it to the implementation forum.

Unfortunately there’s no direct support for istreams. Internally, the DOM uses libxml’s xmlreader module to parse xml. They don’t provide an interface for parsing from a C++ istream (not surprising since libxml is mostly pure C). I do notice they have an xmlReaderForIO function where you provide callbacks to do the stream input. Maybe that could be used to provide direct support for istreams.

The DOM can parse an in-memory document though, so you could load the data from the istream into a buffer and pass that to the DOM. Here’s some sample code for that: