Re: [xml] PATCH: implement xmlSaveToBuffer()
- From: Daniel Veillard <veillard redhat com>
- To: Geert Jansen <geert boskant nl>
- Cc: xml gnome org
- Subject: Re: [xml] PATCH: implement xmlSaveToBuffer()
- Date: Sun, 6 Nov 2005 15:35:07 -0500
On Sun, Nov 06, 2005 at 08:34:39PM +0100, Geert Jansen wrote:
Hi Daniel,
thanks for your reply. I've checked my code and was actually passing in
an xmlOutputBufferPtr, not an xmlBufferPtr! That's why it worked in my
tests. See the (Pyrex/lxml) code below:
buffer = tree.xmlAllocOutputBuffer(encoder)
ctxt = tree.xmlSaveToBuffer(buffer, encoding, options)
tree.xmlSaveDoc(ctxt, self._c_doc)
tree.xmlSaveFlush(ctxt)
s = dumpOutputBuffer(buffer, encoding)
file.write(s)
tree.xmlSaveClose(ctxt)
You should rather use the I/O interface when writing to a file !
Use xmlSaveToIO instead. Define your function for write and close and
use this, this will avoid growing a huge buffer to later dump it to a file.
Can we just change the xmlSaveToBuffer() prototype to accept an
xmlOutputBuffer as per the updated patch attached? Or is there something
which makes it better to have an interface with an xmlBuffer?
The xmlBuffer should be used when you don't dump to an I/O channel.
Then the user just want a memory string and an xmlBuffer makes way more sense
than an xmlOutputBuffer in that case.
The attached patch also comments in and updates the prototype in xmlsave.h.
I don't think it's the right approach, really.
Daniel
--
Daniel Veillard | Red Hat http://redhat.com/
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]