PATH:
opt
/
alt
/
libxml2
/
usr
/
share
/
doc
/
alt-libxml2-devel
/
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 = xmlNewDocNode(doc, NULL, BAD_CAST "root", NULL); 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 (0); } #endif
[-] Makefile.in
[edit]
[-] parse3.o
[edit]
[-] io2
[edit]
[-] reader3.o
[edit]
[-] parse1.o
[edit]
[-] xpath2.c
[edit]
[-] examples.xsl
[edit]
[-] xpath2.o
[edit]
[-] parse2.o
[edit]
[+]
.libs
[-] Makefile
[edit]
[-] io2.c
[edit]
[-] reader2
[edit]
[-] tree2.o
[edit]
[-] parse4.c
[edit]
[-] reader4.c
[edit]
[-] examples.xml
[edit]
[-] reader3.c
[edit]
[-] testWriter.c
[edit]
[-] parse1
[edit]
[-] tree1
[edit]
[-] .memdump
[edit]
[-] index.py
[edit]
[-] reader4.o
[edit]
[-] test1.xml
[edit]
[-] reader4
[edit]
[-] io1
[edit]
[-] test2.xml
[edit]
[-] tree1.o
[edit]
[-] tree2.c
[edit]
[-] parse4.o
[edit]
[-] parse3
[edit]
[-] parse2.c
[edit]
[-] testWriter
[edit]
[-] testWriter.o
[edit]
[-] reader2.c
[edit]
[-] Makefile.am
[edit]
[-] xpath2
[edit]
[-] xpath1.o
[edit]
[-] io2.o
[edit]
[-] reader3
[edit]
[-] parse4
[edit]
[-] tree2
[edit]
[-] reader1.o
[edit]
[-] index.html
[edit]
[-] tree1.c
[edit]
[-] reader2.o
[edit]
[-] parse1.c
[edit]
[-] xpath1
[edit]
[-] parse2
[edit]
[+]
..
[-] test3.xml
[edit]
[-] io1.o
[edit]
[-] parse3.c
[edit]
[-] xpath1.c
[edit]
[-] reader1
[edit]
[-] io1.c
[edit]
[-] reader1.c
[edit]