Commit 03fdeb27 authored by John Fleck's avatar John Fleck
Browse files

John Fleck <jfleck@inkstain.net>


John Fleck <jfleck@inkstain.net>

* doc/examples/io2.c
	* doc/examples/io2.res
	add xmlDocDumpMemory example in response to mailing list FAQ
	(rebuilt xml and html also)
parent f3c3170e
This diff is collapsed.
This diff is collapsed.
/**
* 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 io2.res ; rm -f io2.tmp
* author: John Fleck
* copy: see Copyright for the status of this software.
*/
#include <libxml/parser.h>
int
main() {
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 ((char *)xmlbuff);
/*
* Free associated memory.
*/
xmlFree (xmlbuff);
xmlFreeDoc(doc);
return(0);
}
<?xml version="1.0"?>
<root>content</root>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment