From d03a853bb0370d89552eceee59df1746da4a37f8 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sun, 1 Mar 2009 10:53:23 +0100 Subject: Import upstream version 2.7.0 --- doc/examples/examples.xml | 464 +++++++++++++++++++++++----------------------- 1 file changed, 232 insertions(+), 232 deletions(-) (limited to 'doc/examples/examples.xml') diff --git a/doc/examples/examples.xml b/doc/examples/examples.xml index 2a0827b..a237a0e 100644 --- a/doc/examples/examples.xml +++ b/doc/examples/examples.xml @@ -1,4 +1,36 @@ + + 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/xmlreader.h> + + + + + + + + + + + + + + + + + + + + + +
Load a document, locate subelements with XPath, modify said elements and save the resulting document. Shows how to make a full round-trip from a load/edit/save @@ -32,114 +64,42 @@ - - 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. -
xmlReader
- - <libxml/xmlreader.h> - - - - - - - - - - - - - - - - - -
- - Parse multiple XML files reusing an xmlReader - Demonstrate the use of xmlReaderForFile() and xmlReaderNewFile to parse XML files while reusing the reader object and parser context. (Note that the XMLReader functions require libxml2 version later than 2.6.) - reader4 <filename> [ filename ... ] - reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp - Graham Bennett - see Copyright for the status of this software. -
xmlReader
- - <libxml/xmlreader.h> - - - - - - - - - - - - - - -
- - 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. - parse2 test2.xml - parse2 test2.xml - Daniel Veillard + + 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>] + ./xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp + Aleksey Sanin see Copyright for the status of this software. -
Parsing
+
XPath
- <libxml/tree.h> <libxml/parser.h> + <libxml/xpath.h> + <libxml/xpathInternals.h> + <libxml/tree.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. (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/xmlreader.h> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
@@ -163,27 +123,27 @@ - - 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 + + Output to char buffer + Demonstrate the use of xmlDocDumpMemory to output document to a character buffer + io2 + io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp + John Fleck see Copyright for the status of this software. -
xmlReader
+
InputOutput
- <libxml/xmlreader.h> + <libxml/parser.h> - - - - - - - - - + + + + + + + + +
@@ -200,9 +160,12 @@ + + + @@ -211,45 +174,32 @@ - - Parse an XML document chunk by chunk to a tree and free it - Demonstrate the use of xmlCreatePushParserCtxt() and xmlParseChunk() to read an XML file progressively into a tree and and xmlFreeDoc() to free the resulting tree - parse4 test3.xml - parse4 test3.xml + + 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. -
Parsing
- - <libxml/tree.h> - <libxml/parser.h> - - - - - - - - -
- - Output to char buffer - Demonstrate the use of xmlDocDumpMemory to output document to a character buffer - io2 - io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp - John Fleck - see Copyright for the status of this software. -
InputOutput
+
xmlReader
- <libxml/parser.h> + <libxml/xmlreader.h> - - - - - - - + + + + + + + + + + + + + +
@@ -271,6 +221,7 @@ + @@ -282,6 +233,7 @@ + @@ -296,6 +248,47 @@ + + Parse an XML document chunk by chunk to a tree and free it + Demonstrate the use of xmlCreatePushParserCtxt() and xmlParseChunk() to read an XML file progressively into a tree and and xmlFreeDoc() to free the resulting tree + parse4 test3.xml + parse4 test3.xml + Daniel Veillard + see Copyright for the status of this software. +
Parsing
+ + <libxml/tree.h> + <libxml/parser.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> + + + + + + + + + + +
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. @@ -317,39 +310,6 @@ - - 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>] - ./xpath1 test3.xml '//child2' > xpath1.tmp ; diff xpath1.tmp xpath1.res ; rm xpath1.tmp - Aleksey Sanin - see Copyright for the status of this software. -
XPath
- - <libxml/parser.h> - <libxml/xpath.h> - <libxml/xpathInternals.h> - <libxml/tree.h> - - - - - - - - - - - - - - - - - - - -
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 @@ -384,14 +344,54 @@ + + Parse multiple XML files reusing an xmlReader + Demonstrate the use of xmlReaderForFile() and xmlReaderNewFile to parse XML files while reusing the reader object and parser context. (Note that the XMLReader functions require libxml2 version later than 2.6.) + reader4 <filename> [ filename ... ] + reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp + Graham Bennett + see Copyright for the status of this software. +
xmlReader
+ + <libxml/xmlreader.h> + + + + + + + + + +
+ + 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. + parse2 test2.xml + parse2 test2.xml + Daniel Veillard + see Copyright for the status of this software. +
Parsing
+ + <libxml/tree.h> + <libxml/parser.h> + + + + + + + + +
- - - - + + + + @@ -408,8 +408,8 @@ - + @@ -430,12 +430,12 @@ - - - - + + + + @@ -459,42 +459,42 @@ - - + - + + - + + - - - + - + + - + - - + + @@ -507,27 +507,27 @@ - - - - + + + + - + - + @@ -551,9 +551,9 @@ + - @@ -570,8 +570,8 @@ - + @@ -582,10 +582,10 @@ - - + + @@ -609,54 +609,54 @@ - + - + - + - + - + - + - + - + - - + + - - + + @@ -725,10 +725,10 @@
- +
@@ -739,10 +739,10 @@
- - + +
-- cgit v1.2.3