/usr/share/doc/libxml2-devel/examples
NameSizeModeActions
examples.xml321570644editdlrm
examples.xsl72320644editdlrm
index.html329200644editdlrm
index.py92090644editdlrm
io1.c37530644editdlrm
io1.res1650644editdlrm
io2.c11820644editdlrm
io2.res430644editdlrm
Makefile.am40930644editdlrm
Makefile.in333090644editdlrm
parse1.c13000644editdlrm
parse2.c19670644editdlrm
parse3.c15060644editdlrm
parse4.c35450644editdlrm
reader1.c25300644editdlrm
reader1.res1490644editdlrm
reader2.c31330644editdlrm
reader3.c29470644editdlrm
reader3.res3600644editdlrm
reader4.c31280644editdlrm
reader4.res720644editdlrm
test1.xml70644editdlrm
test2.xml2270644editdlrm
test3.xml8330644editdlrm
testWriter.c385030644editdlrm
tree1.c22450644editdlrm
tree1.res1210644editdlrm
tree2.c34150644editdlrm
tree2.res4530644editdlrm
tst.xml910644editdlrm
writer.xml5440644editdlrm
xpath1.c66240644editdlrm
xpath1.res1140644editdlrm
xpath2.c53300644editdlrm
xpath2.res7570644editdlrm
Edit: /usr/share/doc/libxml2-devel/examples/examples.xml (32157B)
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 $(srcdir)/io1.res Daniel Veillard see Copyright for the status of this software.
InputOutput
<libxml/parser.h> <libxml/xmlIO.h> <libxml/xinclude.h> <libxml/tree.h>
Output to char buffer Demonstrate the use of xmlDocDumpMemory to output document to a character buffer io2 io2 > io2.tmp && diff io2.tmp $(srcdir)/io2.res John Fleck see Copyright for the status of this software.
InputOutput
<libxml/parser.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 parse1 test1.xml parse1 test1.xml Daniel Veillard see Copyright for the status of this software.
Parsing
<libxml/tree.h> <libxml/parser.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>
Parse an XML document in memory to a tree and free it Demonstrate the use of xmlReadMemory() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree parse3 parse3 Daniel Veillard see Copyright for the status of this software.
Parsing
<libxml/tree.h> <libxml/parser.h>
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>
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 $(srcdir)/reader1.res Daniel Veillard see Copyright for the status of this software.
xmlReader
<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. (Note that the XMLReader functions require libxml2 version later than 2.6.) reader2 <valid_xml_filename> reader2 test2.xml > reader1.tmp && diff reader1.tmp $(srcdir)/reader1.res 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. (Note that the XMLReader functions require libxml2 version later than 2.6.) reader3 reader3 > reader3.tmp && diff reader3.tmp $(srcdir)/reader3.res 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 $(srcdir)/reader4.res Graham Bennett see Copyright for the status of this software.
xmlReader
<libxml/xmlreader.h>
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. testWriter testWriter && for i in 1 2 3 4 ; do diff $(srcdir)/writer.xml writer$$i.tmp || break ; done Alfred Mickautsch see Copyright for the status of this software.
xmlWriter
<libxml/encoding.h> <libxml/xmlwriter.h>
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 $(srcdir)/tree1.res Dodji Seketeli see Copyright for the status of this software.
Tree
<libxml/tree.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 $(srcdir)/tree2.res 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>] xpath1 test3.xml '//child2' > xpath1.tmp && diff xpath1.tmp $(srcdir)/xpath1.res Aleksey Sanin see Copyright for the status of this software.
XPath
<libxml/parser.h> <libxml/xpath.h> <libxml/xpathInternals.h> <libxml/tree.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 xpath2 <xml-file> <xpath-expr> <new-value> xpath2 test3.xml '//discarded' discarded > xpath2.tmp && diff xpath2.tmp $(srcdir)/xpath2.res Aleksey Sanin and Daniel Veillard see Copyright for the status of this software.
XPath
<libxml/parser.h> <libxml/xpath.h> <libxml/xpathInternals.h> <libxml/tree.h>