3 * synopsis: Output to char buffer
4 * purpose: Demonstrate the use of xmlDocDumpMemory
5 * to output document to a character buffer
7 * test: io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp
9 * copy: see Copyright for the status of this software.
12 #include <libxml/parser.h>
14 #if defined(LIBXML_TREE_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
25 * Create the document.
27 doc = xmlNewDoc(BAD_CAST "1.0");
28 n = xmlNewNode(NULL, BAD_CAST "root");
29 xmlNodeSetContent(n, BAD_CAST "content");
30 xmlDocSetRootElement(doc, n);
33 * Dump the document to a buffer and print it
34 * for demonstration purposes.
36 xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1);
37 printf("%s", (char *) xmlbuff);
40 * Free associated memory.
55 "library not configured with tree and output support\n");