[xml] Odd errors while using the xmlWriter API


My apologies if this is a FAQ - I could find it answered but I might
have missed something that should have been obvious.

I have some code that uses the xmlWriter API to build up an XML document
in memory. I notice that with some responses a function such as
xmlTextWriterWriteAttribute() or xmlTextWriterStartElement() will return
an error but when I use xmlGetLastError, the message is null. These
errors seem to be triggered by larger responses, but changing the size
of the buffer (and making it huge compared to the documents in question)
does not change the error. Running my code under valgrind reports no
memory access errors. Also, while these errors are predictable in the
sense that the same input causes the same error, different input does
not result in the same pattern of errors - for example, the errors do
not always happen after the 100 call to StartElement.

So, does anyone have any pointers on getting more verbose error messages
from the xmlWriter API? Should I switch from to building a document and
then serializing that? I really would like to keep with the in-memory
text creation API if possible.

Thanks for any advice!

James Gallagher
jgallagher at opendap.org

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