MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlSaveFormatFileTo

Function xmlSaveFormatFileTo

ThirdParty/libxml2/vtklibxml2/xmlsave.c:2871–2895  ·  view source on GitHub ↗

* xmlSaveFormatFileTo: * @buf: an output I/O buffer * @cur: the document * @encoding: the encoding if any assuming the I/O layer handles the transcoding * @format: should formatting spaces been added * * Dump an XML document to an I/O buffer. * Warning ! This call xmlOutputBufferClose() on buf which is not available * after this call. * * returns: the number of bytes written or -1 in

Source from the content-addressed store, hash-verified

2869 * returns: the number of bytes written or -1 in case of failure.
2870 */
2871int
2872xmlSaveFormatFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur,
2873 const char *encoding, int format)
2874{
2875 xmlSaveCtxt ctxt;
2876 int ret;
2877
2878 if (buf == NULL) return(-1);
2879 if ((cur == NULL) ||
2880 ((cur->type != XML_DOCUMENT_NODE) &&
2881 (cur->type != XML_HTML_DOCUMENT_NODE))) {
2882 xmlOutputBufferClose(buf);
2883 return(-1);
2884 }
2885 memset(&ctxt, 0, sizeof(ctxt));
2886 ctxt.buf = buf;
2887 ctxt.level = 0;
2888 ctxt.format = format ? 1 : 0;
2889 ctxt.encoding = (const xmlChar *) encoding;
2890 xmlSaveCtxtInit(&ctxt);
2891 ctxt.options |= XML_SAVE_AS_XML;
2892 xmlDocContentDumpOutput(&ctxt, cur);
2893 ret = xmlOutputBufferClose(buf);
2894 return (ret);
2895}
2896
2897/**
2898 * xmlSaveFormatFileEnc:

Callers 2

closeFileMethod · 0.85
xmlDumpXMLCatalogFunction · 0.85

Calls 3

xmlOutputBufferCloseFunction · 0.85
xmlSaveCtxtInitFunction · 0.85
xmlDocContentDumpOutputFunction · 0.85

Tested by

no test coverage detected