Hello developers,
the current implementation of IPersistStream::Load for XMLDOMDocument takes a copy of the given stream into a hglobal stream, and uses a helper function to parse that, namely parse_xml that calls xmlReadMemory if available (since 2.6.0) and uses the old xmlParseMemory call otherwise.
If libxml2 is new enough, it is possible to parse directly from the stream using xmlReadIO to avoid copying the whole stream contents to memory. The function xmlReadIO was introduced in libxml 2.6.0, five years ago. If I want to use that function, do I have to create an alternative code path for such ancient libxml implemementations, or is it OK to require libxml 2.6.0 as minimum for libxml (even Debian Sarge, i.e. oldstable has it)?
Another question arose on looking at the current implementation. If Wine is not going the direct-stream-to-libxml2-way, but wants to take a copy, currently the copying is performed manually, although there is a function CopyTo in IStream that takes care of creating the copy.
I attached two diff files, - load-via-readio.diff shows the way that calls stream callbacks from libxml2 - load-use-copyto.diff uses the CopyTo function, but still copies.
Thanks in advance for any feedback, Michael Karcher