int DFSerializeXMLFile(DFDocument *doc, NamespaceID defaultNS, int indent, const char *filename, DFError **error) { DFBuffer *buf = DFBufferNew(); DFSerializeXMLBuffer(doc,defaultNS,indent,buf); int r = DFBufferWriteToFile(buf,filename,error); DFBufferRelease(buf); return r; }
static int writeData(DFBuffer *buf, const char *filename, DFError **error) { if ((filename == NULL) || !strcmp(filename,"-")) { fwrite(buf->data,buf->len,1,stdout); return 1; } else if (!DFBufferWriteToFile(buf,filename,error)) { DFErrorFormat(error,"%s: %s",filename,DFErrorMessage(error)); return 0; } else { return 1; } }