summaryrefslogtreecommitdiff
path: root/doc/examples/io2.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2004-07-06 12:57:17 +0000
committerMike Hommey <mh@glandium.org>2004-07-06 12:57:17 +0000
commitc14c53a3645d81281058d4bb4cff24fa8d6faf33 (patch)
tree29bccc2e7499af078a3d1cdcfb517a1dee891be5 /doc/examples/io2.c
parentd4e028c96af89ade493b440d4f2de6b684c03a06 (diff)
downloadlibxml2-c14c53a3645d81281058d4bb4cff24fa8d6faf33.tar.gz
Load /tmp/tmp.DIvcnD/libxml2-2.6.11 intoupstream/2.6.11
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'doc/examples/io2.c')
-rw-r--r--doc/examples/io2.c71
1 files changed, 42 insertions, 29 deletions
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 <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 ((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 <stdio.h>
+
+int
+main(void)
+{
+ fprintf(stderr,
+ "library not configured with tree and output support\n");
+ return (1);
+}
+#endif