Skip to main content

Module save

Module save 

Source
Expand description

XML save-context API (upstream xmlsave.c, 2.15.3).

xmlSaveToFd / xmlSaveToFilename / xmlSaveToBuffer / xmlSaveToIO create a save context; xmlSaveDoc / xmlSaveTree serialize into it; xmlSaveFlush / xmlSaveClose / xmlSaveFinish finalize it.

§UPSTREAM-PARITY

xmlSaveCtxt is opaque in the public headers (xmlsave.h); the candidate defines its own internal representation — there is no ABI constraint on its layout. Behavior mirrors xmlsave.c: options XML_SAVE_FORMAT, XML_SAVE_NO_DECL, XML_SAVE_NO_EMPTY and the deprecated escape callbacks. Formatting/decl handling is provided by the tree serializer (serialize_node_opts), which mirrors upstream’s xmlSaveDoc/ xmlSaveTree/DumpState mechanics.

§Courts

SAVE-* differential cases compare xmlSave* output byte-for-byte with the oracle DSO across option combinations.

Structs§

_xmlSaveCtxt
Candidate-internal save context (opaque upstream).

Constants§

XML_SAVE_FORMAT
XML_SAVE_FORMAT — format output (newlines + indentation).
XML_SAVE_NO_DECL
XML_SAVE_NO_DECL — don’t emit an XML declaration.
XML_SAVE_NO_EMPTY
XML_SAVE_NO_EMPTY — don’t emit empty tags.

Functions§

xmlSaveClose
int xmlSaveClose(xmlSaveCtxt *ctxt) — flush, close and free the context.
xmlSaveDoc
Serialize doc into the save context’s output buffer.
xmlSaveFileTo
int xmlSaveFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding) — upstream xmlsave.c delegates to xmlSaveFormatFileTo(buf, cur, encoding, 0).
xmlSaveFinish
xmlParserErrors xmlSaveFinish(xmlSaveCtxt *ctxt) — flush, close, free; returns an xmlParserErrors code (XML_ERR_OK on success).
xmlSaveFlush
int xmlSaveFlush(xmlSaveCtxt *ctxt) — flush the output buffer.
xmlSaveFormatFileTo
int xmlSaveFormatFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding, int format) — serialize cur into an existing output buffer and close it (upstream xmlsave.c).
xmlSaveSetAttrEscape
int xmlSaveSetAttrEscape(xmlSaveCtxt *ctxt, xmlCharEncodingOutputFunc escape).
xmlSaveSetEscape
int xmlSaveSetEscape(xmlSaveCtxt *ctxt, xmlCharEncodingOutputFunc escape).
xmlSaveSetIndentString
int xmlSaveSetIndentString(xmlSaveCtxt *ctxt, const char *indent).
xmlSaveToBuffer
xmlSaveCtxt *xmlSaveToBuffer(xmlBuffer *buffer, const char *encoding, int options).
xmlSaveToFd
xmlSaveCtxt *xmlSaveToFd(int fd, const char *encoding, int options).
xmlSaveToFilename
xmlSaveCtxt *xmlSaveToFilename(const char *filename, const char *encoding, int options).
xmlSaveToIO
xmlSaveCtxt *xmlSaveToIO(xmlOutputWriteCallback iowrite, xmlOutputCloseCallback ioclose, void *ioctx, const char *encoding, int options).
xmlSaveTree
Serialize a node tree into the save context’s output buffer.