Re: [xml] DTD saving



Hi,

In my program I have a valid xmlDtd parsed using the xmlIOParseDTD() API.
I would like to save it into a buffer. For XML documents I use
xmlSaveFormatFileTo() with a customized xmlOutputBuffer.
How can I do something similar for an xmlDtd ?

 try xmlNodeDumpOutput() with cur == dtd
Thanks; I tried doing something like:

xmlOutputBuffer *buff = xmlAllocOutputBuffer(NULL);
buff->context = &mystream;
buff->writecallback = XMLDTDWrite;
xmlNodeDumpOutput(buff, NULL, (xmlNode *)m_dtd, 1, 0, NULL);

where XMLDTDWrite() is one of my functions. For some reason, it is never
called
and all the output is stored in the "buff->buffer->content" variable....
for me it's not a problem to call the XMLDTDWrite() with
"buff->buffer->content" :-)
but I would like to ask: is this okay or I should use the
xmlNodeDumpOutput API in some other way ?

Another thing: using the snippet above I get in the buff->buffer->content
something like:

<!DOCTYPE none PUBLIC "none" "none" [
.....
]>

I checked and the "doc" pointer of "m_dtd" is NULL so, why the function does
output the dtd as if it is attached into a document ?
I can remove the <!DOCTYPE none PUBLIC "none" "none" [ string manually
after the function call if there is no cleaner way to do this... let me know

PS: I traced the execution of the function and I see it calls a lot of
interesting
functions (like xmlDtdDumpOutput) but they are not accessible outside the
lib...


I've got also another problem with libxml2: when I compile it with MINGW
(version 2.6.16) and then I try to link my app with the libxml2.a
library,
I get various "undefined references to '__imp__xmlFree'".
In fact, I used xmlFree() in my app but with MSVC and BORLAND I have
no problem when linking... how can I do ?
I searched in the archives of this ML and I've found a lot of other people
had
my same/similar problem...
I solved the problem using the static version of the libxml2 library and
then using
the LIBXML_STATIC symbol defined when compiling with mingw my app.
Hope this will be useful to others. ;-)

Thanks,
Francesco Montorsi

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




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