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

Mike Mueller wrote:
I'm using a memory text writer as in the function testXmlwriterMemory()

I create a buffer, a writer, start a document, write some elements, end
the document.  Every one of the write calls returns 0 (no bytes written,
but no errors either).

Examining the buffer in GDB shows it empty:

   $10 = {
      content = 0x3d6380 "",
      use = 0,
      size = 4096,

Examining the writer's out->context field, it's a void pointer with the
same address as the buffer I handed it when the writer was created.

Examining the writer's out->buffer field shows it contains all the data
I wrote!

   $14 = {
      content = 0x3d73f8 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>...",
      use = 192,
      size = 4096,

I truncated the content field because it was large, but it had my
complete XML document inside it.  So the writer is apparently doing most
of its job, except it won't put any data into my buffer.

Anyone know why this would happen?

Mike Mueller
mike subfocal net

If you compile and run the test program you reference, does it work OK 
(it certainly does for me)?  Assuming that it does, then what are the
differences between your code and the function in the test program?  What
does gdb show for the test program buffer?  When you say "Every one of
the write calls returns 0" are you describing the return code from a
fuction like xmlTextWriterStartElement?  If so, 0 means success, and a
negative value means error.


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