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



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/> ).

xmlDocDumpMemory( document, &outBuffer, &outBufferLen );
size = xmlNodeDump( &tmpNodeBuffer, document, rootNode, level, format );

xmlNodeDump( ) parameters contain the level and format Document Saving
Context (xmlSaveCtxt Ctxt) struct variables, but not "option". Setting the
XML_SAVE_NO_DECL and XML_SAVE_NO_EMPTY values for the
Ctxt.option would provide the desired output. A local Ctxt struct is initialized
and set internally by xmlNodeDumpOutput, which calls xmlNodeDump.

While I can pull the approapriate functions out of Libxml2 to perform what
I need will a future release have the Ctxt.options as paramters to one of the
xmlDocDumpXXX or xmlNodeDumpXXX API's? Or is there an alternate
method of calling the Libxml2 functions?

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








--
==================
Daniel P. Ryan
Dolphin Technology
(315)838-7030
dan dolphtech com
==================




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