PATH:
usr
/
share
/
doc
/
libxml2-devel-2.9.1
/
examples
/** * section: InputOutput * synopsis: Output to char buffer * purpose: Demonstrate the use of xmlDocDumpMemory * to output document to a character buffer * usage: io2 * test: io2 > io2.tmp && diff io2.tmp $(srcdir)/io2.res * author: John Fleck * copy: see Copyright for the status of this software. */ #include <libxml/parser.h> #if defined(LIBXML_TREE_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) int main(void) { xmlNodePtr n; xmlDocPtr doc; xmlChar *xmlbuff; int buffersize; /* * Create the document. */ doc = xmlNewDoc(BAD_CAST "1.0"); n = xmlNewNode(NULL, BAD_CAST "root"); xmlNodeSetContent(n, BAD_CAST "content"); xmlDocSetRootElement(doc, n); /* * Dump the document to a buffer and print it * for demonstration purposes. */ xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1); printf("%s", (char *) xmlbuff); /* * Free associated memory. */ xmlFree(xmlbuff); xmlFreeDoc(doc); return (0); } #else #include <stdio.h> int main(void) { fprintf(stderr, "library not configured with tree and output support\n"); return (1); } #endif
[-] writer.xml
[edit]
[-] io1.res
[edit]
[-] reader1.c
[edit]
[-] xpath1.c
[edit]
[-] tree2.res
[edit]
[-] parse3.c
[edit]
[+]
..
[-] reader3.c
[edit]
[-] index.html
[edit]
[-] xpath2.c
[edit]
[-] reader4.res
[edit]
[-] parse1.c
[edit]
[-] reader3.res
[edit]
[-] reader1.res
[edit]
[-] tree1.res
[edit]
[-] tree1.c
[edit]
[-] xpath1.res
[edit]
[-] examples.xml
[edit]
[-] reader2.c
[edit]
[-] index.py
[edit]
[-] test3.xml
[edit]
[-] io2.c
[edit]
[-] xpath2.res
[edit]
[-] reader4.c
[edit]
[-] testWriter.c
[edit]
[-] parse2.c
[edit]
[-] parse4.c
[edit]
[-] tree2.c
[edit]
[-] Makefile.am
[edit]
[-] Makefile.in
[edit]
[-] tst.xml
[edit]
[-] io2.res
[edit]
[-] io1.c
[edit]
[-] test1.xml
[edit]
[-] examples.xsl
[edit]
[-] test2.xml
[edit]