summaryrefslogtreecommitdiff
path: root/doc/examples
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
parentd4e028c96af89ade493b440d4f2de6b684c03a06 (diff)
downloadlibxml2-upstream/2.6.11.tar.gz
Load /tmp/tmp.DIvcnD/libxml2-2.6.11 intoupstream/2.6.11
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/Makefile.am1
-rw-r--r--doc/examples/Makefile.in1
-rw-r--r--doc/examples/examples.xml22
-rwxr-xr-xdoc/examples/index.py1
-rw-r--r--doc/examples/io2.c71
-rw-r--r--doc/examples/parse4.c7
-rw-r--r--doc/examples/testWriter.c8
7 files changed, 67 insertions, 44 deletions
diff --git a/doc/examples/Makefile.am b/doc/examples/Makefile.am
index 0d4bf13..26d143f 100644
--- a/doc/examples/Makefile.am
+++ b/doc/examples/Makefile.am
@@ -93,6 +93,7 @@ valgrind:
$(MAKE) CHECKER='valgrind -q' tests
tests: $(noinst_PROGRAMS)
+ @(echo '## examples regression tests')
@(echo > .memdump)
@($(CHECKER) ././xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
diff --git a/doc/examples/Makefile.in b/doc/examples/Makefile.in
index 237a07a..d2cd675 100644
--- a/doc/examples/Makefile.in
+++ b/doc/examples/Makefile.in
@@ -689,6 +689,7 @@ valgrind:
$(MAKE) CHECKER='valgrind -q' tests
tests: $(noinst_PROGRAMS)
+ @(echo '## examples regression tests')
@(echo > .memdump)
@($(CHECKER) ././xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp)
@(grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" ; exit 0)
diff --git a/doc/examples/examples.xml b/doc/examples/examples.xml
index 03f2db7..0d45494 100644
--- a/doc/examples/examples.xml
+++ b/doc/examples/examples.xml
@@ -309,10 +309,10 @@
<include>&lt;libxml/parser.h&gt;</include>
</includes>
<uses>
- <function line='93' file='parser' name='xmlFreeParserCtxt'/>
- <function line='85' file='parser' name='xmlParseChunk'/>
- <function line='66' file='parser' name='xmlCreatePushParserCtxt'/>
- <typedef line='44' file='tree' name='xmlParserCtxtPtr'/>
+ <function line='94' file='parser' name='xmlFreeParserCtxt'/>
+ <function line='86' file='parser' name='xmlParseChunk'/>
+ <function line='67' file='parser' name='xmlCreatePushParserCtxt'/>
+ <typedef line='45' file='tree' name='xmlParserCtxtPtr'/>
</uses>
</example>
<example filename='io2.c'>
@@ -327,13 +327,13 @@
<include>&lt;libxml/parser.h&gt;</include>
</includes>
<uses>
- <function line='27' file='tree' name='xmlNodeSetContent'/>
- <function line='34' file='tree' name='xmlDocDumpFormatMemory'/>
- <variable line='40' file='globals' name='xmlFree'/>
- <function line='28' file='tree' name='xmlDocSetRootElement'/>
- <typedef line='17' file='tree' name='xmlNodePtr'/>
- <function line='25' file='tree' name='xmlNewDoc'/>
- <function line='26' file='tree' name='xmlNewNode'/>
+ <function line='29' file='tree' name='xmlNodeSetContent'/>
+ <function line='36' file='tree' name='xmlDocDumpFormatMemory'/>
+ <variable line='42' file='globals' name='xmlFree'/>
+ <function line='30' file='tree' name='xmlDocSetRootElement'/>
+ <typedef line='19' file='tree' name='xmlNodePtr'/>
+ <function line='27' file='tree' name='xmlNewDoc'/>
+ <function line='28' file='tree' name='xmlNewNode'/>
</uses>
</example>
<example filename='xpath2.c'>
diff --git a/doc/examples/index.py b/doc/examples/index.py
index 466cfc9..944c181 100755
--- a/doc/examples/index.py
+++ b/doc/examples/index.py
@@ -251,6 +251,7 @@ install-data-local:
example, example)
Makefile = Makefile + "valgrind: \n\t$(MAKE) CHECKER='valgrind -q' tests\n\n"
Makefile = Makefile + "tests: $(noinst_PROGRAMS)\n"
+ Makefile = Makefile + "\t@(echo '## examples regression tests')\n"
Makefile = Makefile + "\t@(echo > .memdump)\n"
for test in tests:
Makefile = Makefile + "\t@($(CHECKER) %s)\n" % (test)
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
diff --git a/doc/examples/parse4.c b/doc/examples/parse4.c
index fe57894..3e28056 100644
--- a/doc/examples/parse4.c
+++ b/doc/examples/parse4.c
@@ -14,6 +14,7 @@
#include <libxml/parser.h>
#include <libxml/tree.h>
+#ifdef LIBXML_PUSH_ENABLED
static FILE *desc;
/**
@@ -134,3 +135,9 @@ int main(int argc, char **argv) {
xmlMemoryDump();
return(0);
}
+#else /* ! LIBXML_PUSH_ENABLED */
+int main(int argc, char **argv) {
+ fprintf(stderr, "Library not compiled with push parser support\n");
+ return(1);
+}
+#endif
diff --git a/doc/examples/testWriter.c b/doc/examples/testWriter.c
index 02f9eb7..c5e9c39 100644
--- a/doc/examples/testWriter.c
+++ b/doc/examples/testWriter.c
@@ -80,7 +80,7 @@ testXmlwriterFilename(const char *uri)
}
/* Start the document with the xml default for the version,
- * encoding ISO 8858-1 and the default for the standalone
+ * encoding ISO 8859-1 and the default for the standalone
* declaration. */
rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL);
if (rc < 0) {
@@ -359,7 +359,7 @@ testXmlwriterMemory(const char *file)
}
/* Start the document with the xml default for the version,
- * encoding ISO 8858-1 and the default for the standalone
+ * encoding ISO 8859-1 and the default for the standalone
* declaration. */
rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL);
if (rc < 0) {
@@ -636,7 +636,7 @@ testXmlwriterDoc(const char *file)
}
/* Start the document with the xml default for the version,
- * encoding ISO 8858-1 and the default for the standalone
+ * encoding ISO 8859-1 and the default for the standalone
* declaration. */
rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL);
if (rc < 0) {
@@ -908,7 +908,7 @@ testXmlwriterTree(const char *file)
}
/* Start the document with the xml default for the version,
- * encoding ISO 8858-1 and the default for the standalone
+ * encoding ISO 8859-1 and the default for the standalone
* declaration. */
rc = xmlTextWriterStartDocument(writer, NULL, MY_ENCODING, NULL);
if (rc < 0) {