[xml] in-memory compression?



Questions about compression and whitespace:

  a) It is stated that the library transparently handles compression
when doing file-based access.  How about memory?  Specifically, I'm
filling a buffer with xmlDocDumpMemory() and then sending the buffer out
through a socket without ever saving it to a file, and I'd really like
to be able to turn on compression to reduce the network load at the
modest expense of cpu load.  However, the commands that set compression
don't seem to work on the memory buffer.  I imagine that I'd encounter
the same problem at the other end with xmlParseMemory after I read from
the socket into a buffer and then parse the buffer into an xmlDoc.


Do any of the memory<->doc conversion pairs manage compression and
decompression of document images?


  b) On the same note, although I like seeing all the lovely indentation
when debugging, I'd be perfectly happy for all the spaces to be stripped
before sending (compressed or not) when the daemon is talking directly
to the client with no humans trying to read the stream directly.
xmlDocDumpFormatMemory() says that something like:

 xmlDocDumpFormatMemory(doc,&buffer,&docsize,1 or 0)

should control whitespace indentation to be added to the dump, depending
on xmlIndentTreeOutput or xmlKeepBlanksDefault.  However, when I try to
use this command my linker cannot find it in the library.  It finds
xmlDocDumpMemory() just fine.

I can always insert zlib calls into the memory stream after the dump and
after the read at the other end (assuming that's what is happening
inside libxml) but using libxml's "transparent handling of compression"
would certainly be simpler from the coding point of view, if it extends
consistently to the memory dump level so I can avoid the overhead of
files.

   rgb

-- 
Robert G. Brown                        http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb phy duke edu






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