I am writing a wrapper for outputting a document to
a (privately defined) memory buffer list. I followed the example, and used my
own xmlOutputBufferPtr with my private structure (struct smgbuflist ) in
the context member. I ended up with the following piece of code - plagiarized
from xmlSaveFormatFileEnc() :-)
int save_format_xml_to_buflist(xmlDocPtr pdoc,
struct smgbuflist *pbl, const char *encoding, int format)
{ ....
if(!(pob=mg_buflist_outputbuffer_new(pbl,
handler)))GOTO_ERROR;
xmlDocContentDumpOutput(pob, pdoc, encoding, format); if((ret=mg_buflist_outputbuffer_free(pob))<0)GOTO_ERROR; return(ret); ..... }
Unfortunately, xmlDocContentDumpOutput() is static
to tree.c.
I made it global and added its declaration in
tree.h , and everything runs smoothly.
I think that this function should be exposed, as it
is *the* primitive for doing any kind of output.
Any comments?
Michel Gouget
|