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§
- _xml
Save Ctxt - 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§
- xmlSave
Close ⚠ int xmlSaveClose(xmlSaveCtxt *ctxt)— flush, close and free the context.- xmlSave
Doc ⚠ - Serialize
docinto the save context’s output buffer. - xmlSave
File ⚠To int xmlSaveFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding)— upstream xmlsave.c delegates to xmlSaveFormatFileTo(buf, cur, encoding, 0).- xmlSave
Finish ⚠ xmlParserErrors xmlSaveFinish(xmlSaveCtxt *ctxt)— flush, close, free; returns an xmlParserErrors code (XML_ERR_OK on success).- xmlSave
Flush ⚠ int xmlSaveFlush(xmlSaveCtxt *ctxt)— flush the output buffer.- xmlSave
Format ⚠File To int xmlSaveFormatFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding, int format)— serializecurinto an existing output buffer and close it (upstream xmlsave.c).- xmlSave
SetAttr ⚠Escape int xmlSaveSetAttrEscape(xmlSaveCtxt *ctxt, xmlCharEncodingOutputFunc escape).- xmlSave
SetEscape ⚠ int xmlSaveSetEscape(xmlSaveCtxt *ctxt, xmlCharEncodingOutputFunc escape).- xmlSave
SetIndent ⚠String int xmlSaveSetIndentString(xmlSaveCtxt *ctxt, const char *indent).- xmlSave
ToBuffer ⚠ xmlSaveCtxt *xmlSaveToBuffer(xmlBuffer *buffer, const char *encoding, int options).- xmlSave
ToFd ⚠ xmlSaveCtxt *xmlSaveToFd(int fd, const char *encoding, int options).- xmlSave
ToFilename ⚠ xmlSaveCtxt *xmlSaveToFilename(const char *filename, const char *encoding, int options).- xmlSave
ToIO ⚠ xmlSaveCtxt *xmlSaveToIO(xmlOutputWriteCallback iowrite, xmlOutputCloseCallback ioclose, void *ioctx, const char *encoding, int options).- xmlSave
Tree ⚠ - Serialize a node tree into the save context’s output buffer.