Re: [xml] Parsing from a compressed string



On Sun, Jul 13, 2008 at 07:44:12AM +0200, Stefan Behnel wrote:
Hi,

it seems that libxml2 can parse zlib compressed data from files. What would be
the right way to parse compressed data from a string in memory? And, yes, I
want to avoid unpacking it before I parse it.

  The simplest I can see is use
   http://xmlsoft.org/html/libxml-parser.html#xmlReadIO
and providing ioread/ioclose/ioctxt to be compressed read/close and buffer
arguments.

Same question for serialisation? Is there anything like a compressing
OutputBuffer?

  No but similary you can use xmlSaveToIO
   http://xmlsoft.org/html/libxml-xmlsave.html#xmlSaveToIO
with a compressed write and close.

  The harder is probably to debug the provided compressed handlers around
the edge cases, but it really shoudl not be much code if using existing
compression APIs.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]