Re: [xml] Using Doc Saving Context Options when dumping doc.



Daniel,
My comments may have been misleading.
I wish to output a document that has been altered once loaded/parsed.
While the data was read from memory, parsed,
and stored into a document (xmlDocPtr), the
xmlDocDumpMemory or xmNodeDump functions
output the xmlDocPtr to a buffer.

It does not appear that xmlSaveToBuffer provides
the same capability. xmlSaveToBuffer uses a buffer
as input, where I wish to used the updated xmlNodePtr.

xmlSaveDoc uses a xmlSaveCtxtPtr and xmlDocPtr,
however the xmlSaveCtxtInit /New/Save functions
are not public API's that can be called directly to
create a Ctxt pointer with necessary options.

Suggestions?

Thanks.............Dan

Daniel Veillard wrote:
On Tue, May 01, 2007 at 01:14:42PM -0400, Dan Ryan wrote:
  
Using Doc Saving Context Options to xmlDocDumpMemory( )
How do you omit the XML Declaration and Empty Element nodes
when dumping a document from memory?

Libxml2-2.6.2x provides the capability to output an XML document that
has been loaded, parsed, and stored in memory. The XmlNodeDump and
xmlDocDumpMemory functions will dump the document to a buffer.
However, in certain cases I do "not" want to output the XML Declaration
and Empty Elements as a single empty-node (i.e. <empty/> ).
    

  Do not use the old API, but the new xmlSave stuff
    http://xmlsoft.org/html/libxml-xmlsave.html#xmlSaveOption
    http://xmlsoft.org/html/libxml-xmlsave.html#xmlSaveToBuffer

read the functions in that module

Daniel

  


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