Re: [xml] Text writer memory won't write



-----Original Message-----
From: xml-bounces gnome org [mailto:xml-bounces gnome org] On Behalf
Of
Daniel Veillard
Sent: Friday, January 19, 2007 1:52 AM
To: xml gnome org
Subject: Re: [xml] Text writer memory won't write

On Thu, Jan 18, 2007 at 10:57:25PM -0500, Mike Mueller wrote:
On Thu, Jan 18, 2007 at 07:18:51PM -0800, William M. Brack wrote:
Mike Mueller wrote:
I compiled the test program and it works fine.  It turns out the
data
gets dumped into the buffer when you call xmlFreeTextWriter.  I
wasn't
freeing the writer until much after I tried to find my data in the
buffer.  Of course, the documentation for this function simply says:

    Deallocate all the resources associated to the writer

Yay for confusing APIs.

  This is standard behaviour to flush on close when doing pipe like
processing, simply to avoid the cost of sync'ing out at every single
write. Mind you if you use an I/O function which for example send a
packet to a network interface, your really *do not want* to get a
packet
out each time you Write a new attribute to your stream. If that's what
you require, I really suggest you write your own synchronous API,
because
except you nobody expects or want this !

I think the design (flushing on termination) is fine, but there's room
to improve the name or the documentation: an "xmlFree*" function doesn't
say "finalize" or "terminate", so if that name must stay then the
documentation should say that this function is needed in order to flush
the output.

-- James




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