From c14c53a3645d81281058d4bb4cff24fa8d6faf33 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 6 Jul 2004 12:57:17 +0000 Subject: Load /tmp/tmp.DIvcnD/libxml2-2.6.11 into packages/libxml2/branches/upstream/current. --- doc/examples/io2.c | 71 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 29 deletions(-) (limited to 'doc/examples/io2.c') diff --git a/doc/examples/io2.c b/doc/examples/io2.c index 59dede2..2659ef1 100644 --- a/doc/examples/io2.c +++ b/doc/examples/io2.c @@ -11,35 +11,48 @@ #include +#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 ((char *)xmlbuff); - - /* - * Free associated memory. - */ - xmlFree (xmlbuff); - xmlFreeDoc(doc); - - return(0); +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((char *) xmlbuff); + + /* + * Free associated memory. + */ + xmlFree(xmlbuff); + xmlFreeDoc(doc); + + return (0); } +#else +#include + +int +main(void) +{ + fprintf(stderr, + "library not configured with tree and output support\n"); + return (1); +} +#endif -- cgit v1.2.3