From ba6bec6762446b51cd57ec00940c320ec650f4ad Mon Sep 17 00:00:00 2001 From: MST 2004 John Fleck Date: Sat, 31 Jan 2004 03:48:11 +0000 Subject: [PATCH] doc/examples/examples.xml doc/examples/*.html add note that reader Fri Jan 30 20:45:36 MST 2004 John Fleck * doc/examples/examples.xml * doc/examples/*.html add note that reader examples need libmxl2 > 2.6, rebuild html --- doc/examples/.cvsignore | 10 +- doc/examples/examples.xml | 372 +++++++++++++++++++------------------- doc/examples/index.html | 2 +- 3 files changed, 192 insertions(+), 192 deletions(-) diff --git a/doc/examples/.cvsignore b/doc/examples/.cvsignore index 00877b27..e0ef2ffd 100644 --- a/doc/examples/.cvsignore +++ b/doc/examples/.cvsignore @@ -1,13 +1,13 @@ .memdump Makefile.in Makefile -xpath1 +io1 parse1 parse2 -tree1 -tree2 -testWriter reader1 reader2 reader3 -io1 +testWriter +tree1 +tree2 +xpath1 diff --git a/doc/examples/examples.xml b/doc/examples/examples.xml index 77988632..b8273d78 100644 --- a/doc/examples/examples.xml +++ b/doc/examples/examples.xml @@ -1,39 +1,28 @@ - - Evaluate XPath expression and prints result node set. - Shows how to evaluate XPath expression and register known namespaces in XPath context. - xpath1 <xml-file> <xpath-expr> [<known-ns-list>] - Aleksey Sanin + + Example of custom Input/Output + Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way. + io1 + io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp + Daniel Veillard see Copyright for the status of this software. -
XPath
+
InputOutput
- <libxml/xpath.h> <libxml/parser.h> - <libxml/xpathInternals.h> + <libxml/xinclude.h> <libxml/tree.h> + <libxml/xmlIO.h> - - - - - - - - - - - - - - - - - - - - - + + + + + + + + +
@@ -82,53 +71,90 @@ - - Navigates a tree to print element names - Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order. - tree1 filename_or_URL - tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp - Dodji Seketeli + + Parse an XML file with an xmlReader + Demonstrate the use of xmlReaderForFile() to parse an XML file and dump the informations about the nodes found in the process. (Note that the XMLReader functions require libxml2 version later than 2.6.) + reader1 <filename> + reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp + Daniel Veillard see Copyright for the status of this software. -
Tree
+
xmlReader
- <libxml/tree.h> - <libxml/parser.h> + <libxml/xmlreader.h> - - - - - - + + + + + + + + + + + + + +
- - Creates a tree - Shows how to create document, nodes and dump it to stdout or file. - tree2 <filename> -Default output: stdout - tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp - Lucas Brasilino <brasilino@recife.pe.gov.br> - see Copyright for the status of this software -
Tree
+ + Parse and validate an XML file with an xmlReader + Demonstrate the use of xmlReaderForFile() to parse an XML file validating the content in the process and activating options like entities substitution, and DTD attributes defaulting. (Note that the XMLReader functions require libxml2 version later than 2.6.) + reader2 <valid_xml_filename> + reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp + Daniel Veillard + see Copyright for the status of this software. +
xmlReader
- <libxml/tree.h> - <libxml/parser.h> + <libxml/xmlreader.h> - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +
+ + Show how to extract subdocuments with xmlReader + Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document. (Note that the XMLReader functions require libxml2 version later than 2.6.) + reader3 + reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp + Daniel Veillard + see Copyright for the status of this software. +
xmlReader
+ + <libxml/xmlreader.h> + + + + + + + + + + + + + +
@@ -150,7 +176,6 @@ - @@ -164,14 +189,12 @@ - - @@ -180,120 +203,97 @@ - - Parse an XML file with an xmlReader - Demonstrate the use of xmlReaderForFile() to parse an XML file and dump the informations about the nodes found in the process - reader1 <filename> - reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp - Daniel Veillard + + Navigates a tree to print element names + Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order. + tree1 filename_or_URL + tree1 test2.xml > tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp + Dodji Seketeli see Copyright for the status of this software. -
xmlReader
+
Tree
- <libxml/xmlreader.h> - - - - - - - - - - - - - - - -
- - Parse and validate an XML file with an xmlReader - Demonstrate the use of xmlReaderForFile() to parse an XML file validating the content in the process and activating options like entities substitution, and DTD attributes defaulting - reader2 <valid_xml_filename> - reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp - Daniel Veillard - see Copyright for the status of this software. -
xmlReader
- - <libxml/xmlreader.h> - - - - - - - - - - - - - - - - - - -
- - Show how to extract subdocuments with xmlReader - Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document - reader3 - reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp - Daniel Veillard - see Copyright for the status of this software. -
xmlReader
- - <libxml/xmlreader.h> - - - - - - - - - - - -
- - Example of custom Input/Output - Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way. - io1 - io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp - Daniel Veillard - see Copyright for the status of this software. -
InputOutput
- - <libxml/parser.h> - <libxml/xinclude.h> <libxml/tree.h> - <libxml/xmlIO.h> + <libxml/parser.h> - - - - - + + + + + +
+ + Creates a tree + Shows how to create document, nodes and dump it to stdout or file. + tree2 <filename> -Default output: stdout + tree2 > tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp + Lucas Brasilino <brasilino@recife.pe.gov.br> + see Copyright for the status of this software +
Tree
+ + <libxml/tree.h> + <libxml/parser.h> + + + + + + + + + + + + +
+ + Evaluate XPath expression and prints result node set. + Shows how to evaluate XPath expression and register known namespaces in XPath context. + xpath1 <xml-file> <xpath-expr> [<known-ns-list>] + Aleksey Sanin + see Copyright for the status of this software. +
XPath
+ + <libxml/xpath.h> + <libxml/parser.h> + <libxml/xpathInternals.h> + <libxml/tree.h> + + + + + + + + + + + + + + + + + + +
- + - - - + + + - + @@ -324,12 +324,12 @@ - + - - - + + + @@ -338,38 +338,38 @@ - + - + - - + + - + - + - + - - + + @@ -389,19 +389,19 @@ - + - - + + - + @@ -431,15 +431,15 @@ - + - + diff --git a/doc/examples/index.html b/doc/examples/index.html index 4be2d438..33071c8a 100644 --- a/doc/examples/index.html +++ b/doc/examples/index.html @@ -8,4 +8,4 @@ H2 {font-family: Verdana,Arial,Helvetica} H3 {font-family: Verdana,Arial,Helvetica} A:link, A:visited, A:active { text-decoration: underline } Libxml2 set of examples
Action against software patentsGnome2 LogoW3C LogoRed Hat Logo
Made with Libxml2 Logo

Libxml2 set of examples

Examples Menu
Related links

The examples are stored per section depending on the main focus - of the example:

InputOutput Examples

io1.c: Example of custom Input/Output

Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way.

Includes:

Uses:

Usage:

io1

Author: Daniel Veillard

Parsing Examples

parse1.c: Parse an XML file to a tree and free it

Demonstrate the use of xmlReadFile() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree

Includes:

Uses:

Usage:

parse1 test1.xml

Author: Daniel Veillard

parse2.c: Parse and validate an XML file to a tree and free the result

Create a parser context for an XML file, then parse and validate the file, creating a tree, check the validation result and xmlFreeDoc() to free the resulting tree.

Includes:

Uses:

Usage:

parse2 test2.xml

Author: Daniel Veillard

Tree Examples

tree1.c: Navigates a tree to print element names

Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order.

Includes:

Uses:

Usage:

tree1 filename_or_URL

Author: Dodji Seketeli

tree2.c: Creates a tree

Shows how to create document, nodes and dump it to stdout or file.

Includes:

Uses:

Usage:

tree2 <filename> -Default output: stdout

Author: Lucas Brasilino <brasilino@recife.pe.gov.br>

XPath Examples

xpath1.c: Evaluate XPath expression and prints result node set.

Shows how to evaluate XPath expression and register known namespaces in XPath context.

Includes:

Uses:

Usage:

xpath1 <xml-file> <xpath-expr> [<known-ns-list>]

Author: Aleksey Sanin

xmlReader Examples

reader1.c: Parse an XML file with an xmlReader

Demonstrate the use of xmlReaderForFile() to parse an XML file and dump the informations about the nodes found in the process

Includes:

Uses:

Usage:

reader1 <filename>

Author: Daniel Veillard

reader2.c: Parse and validate an XML file with an xmlReader

Demonstrate the use of xmlReaderForFile() to parse an XML file validating the content in the process and activating options like entities substitution, and DTD attributes defaulting

Includes:

Uses:

Usage:

reader2 <valid_xml_filename>

Author: Daniel Veillard

reader3.c: Show how to extract subdocuments with xmlReader

Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document

Includes:

Uses:

Usage:

reader3

Author: Daniel Veillard

xmlWriter Examples

testWriter.c: use various APIs for the xmlWriter

tests a number of APIs for the xmlWriter, especially the various methods to write to a filename, to a memory buffer, to a new document, or to a subtree. It shows how to do encoding string conversions too. The resulting documents are then serialized.

Includes:

Uses:

Usage:

testWriter

Author: Alfred Mickautsch

Daniel Veillard

+ of the example:

InputOutput Examples

io1.c: Example of custom Input/Output

Demonstrate the use of xmlRegisterInputCallbacks to build a custom I/O layer, this is used in an XInclude method context to show how dynamic document can be built in a clean way.

Includes:

Uses:

Usage:

io1

Author: Daniel Veillard

Parsing Examples

parse1.c: Parse an XML file to a tree and free it

Demonstrate the use of xmlReadFile() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree

Includes:

Uses:

Usage:

parse1 test1.xml

Author: Daniel Veillard

parse2.c: Parse and validate an XML file to a tree and free the result

Create a parser context for an XML file, then parse and validate the file, creating a tree, check the validation result and xmlFreeDoc() to free the resulting tree.

Includes:

Uses:

Usage:

parse2 test2.xml

Author: Daniel Veillard

Tree Examples

tree1.c: Navigates a tree to print element names

Parse a file to a tree, use xmlDocGetRootElement() to get the root element, then walk the document and print all the element name in document order.

Includes:

Uses:

Usage:

tree1 filename_or_URL

Author: Dodji Seketeli

tree2.c: Creates a tree

Shows how to create document, nodes and dump it to stdout or file.

Includes:

Uses:

Usage:

tree2 <filename> -Default output: stdout

Author: Lucas Brasilino <brasilino@recife.pe.gov.br>

XPath Examples

xpath1.c: Evaluate XPath expression and prints result node set.

Shows how to evaluate XPath expression and register known namespaces in XPath context.

Includes:

Uses:

Usage:

xpath1 <xml-file> <xpath-expr> [<known-ns-list>]

Author: Aleksey Sanin

xmlReader Examples

reader1.c: Parse an XML file with an xmlReader

Demonstrate the use of xmlReaderForFile() to parse an XML file and dump the informations about the nodes found in the process. (Note that the XMLReader functions require libxml2 version later than 2.6.)

Includes:

Uses:

Usage:

reader1 <filename>

Author: Daniel Veillard

reader2.c: Parse and validate an XML file with an xmlReader

Demonstrate the use of xmlReaderForFile() to parse an XML file validating the content in the process and activating options like entities substitution, and DTD attributes defaulting. (Note that the XMLReader functions require libxml2 version later than 2.6.)

Includes:

Uses:

Usage:

reader2 <valid_xml_filename>

Author: Daniel Veillard

reader3.c: Show how to extract subdocuments with xmlReader

Demonstrate the use of xmlTextReaderPreservePattern() to parse an XML file with the xmlReader while collecting only some subparts of the document. (Note that the XMLReader functions require libxml2 version later than 2.6.)

Includes:

Uses:

Usage:

reader3

Author: Daniel Veillard

xmlWriter Examples

testWriter.c: use various APIs for the xmlWriter

tests a number of APIs for the xmlWriter, especially the various methods to write to a filename, to a memory buffer, to a new document, or to a subtree. It shows how to do encoding string conversions too. The resulting documents are then serialized.

Includes:

Uses:

Usage:

testWriter

Author: Alfred Mickautsch

Daniel Veillard