📄 examples.xml
字号:
<examples> <example filename='io1.c'> <synopsis>Example of custom Input/Output</synopsis> <purpose>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.</purpose> <usage>io1</usage> <test>io1 > io1.tmp ; diff io1.tmp io1.res ; rm -f io1.tmp</test> <author>Daniel Veillard</author> <copy>see Copyright for the status of this software. </copy> <section>InputOutput</section> <includes> <include><libxml/parser.h></include> <include><libxml/xmlIO.h></include> <include><libxml/xinclude.h></include> <include><libxml/tree.h></include> </includes> <uses> <function line='143' file='tree' name='xmlDocDump'/> <function line='158' file='xmlmemory' name='xmlMemoryDump'/> <function line='149' file='tree' name='xmlFreeDoc'/> <function line='154' file='parser' name='xmlCleanupParser'/> <macro line='117' file='xmlversion' name='LIBXML_TEST_VERSION'/> <function line='134' file='xinclude' name='xmlXIncludeProcess'/> <function line='117' file='xmlIO' name='xmlRegisterInputCallbacks'/> <function line='124' file='parser' name='xmlReadMemory'/> <typedef line='105' file='tree' name='xmlDocPtr'/> </uses> </example> <example filename='io2.c'> <synopsis>Output to char buffer</synopsis> <purpose>Demonstrate the use of xmlDocDumpMemory to output document to a character buffer</purpose> <usage>io2</usage> <test>io2 > io2.tmp ; diff io2.tmp io2.res ; rm -f io2.tmp</test> <author>John Fleck</author> <copy>see Copyright for the status of this software. </copy> <section>InputOutput</section> <includes> <include><libxml/parser.h></include> </includes> <uses> <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='20' file='tree' name='xmlDocPtr'/> <function line='43' file='tree' name='xmlFreeDoc'/> <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='parse1.c'> <synopsis>Parse an XML file to a tree and free it</synopsis> <purpose>Demonstrate the use of xmlReadFile() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree</purpose> <usage>parse1 test1.xml</usage> <test>parse1 test1.xml</test> <author>Daniel Veillard</author> <copy>see Copyright for the status of this software. </copy> <section>Parsing</section> <includes> <include><libxml/tree.h></include> <include><libxml/parser.h></include> </includes> <uses> <function line='54' file='xmlmemory' name='xmlMemoryDump'/> <function line='50' file='parser' name='xmlCleanupParser'/> <macro line='45' file='xmlversion' name='LIBXML_TEST_VERSION'/> <typedef line='24' file='tree' name='xmlDocPtr'/> <function line='31' file='tree' name='xmlFreeDoc'/> <function line='26' file='parser' name='xmlReadFile'/> </uses> </example> <example filename='parse2.c'> <synopsis>Parse and validate an XML file to a tree and free the result</synopsis> <purpose>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.</purpose> <usage>parse2 test2.xml</usage> <test>parse2 test2.xml</test> <author>Daniel Veillard</author> <copy>see Copyright for the status of this software. </copy> <section>Parsing</section> <includes> <include><libxml/tree.h></include> <include><libxml/parser.h></include> </includes> <uses> <function line='47' file='parser' name='xmlFreeParserCtxt'/> <enum line='35' file='parser' name='XML_PARSE_DTDVALID'/> <function line='29' file='parser' name='xmlNewParserCtxt'/> <typedef line='25' file='tree' name='xmlParserCtxtPtr'/> <function line='35' file='parser' name='xmlCtxtReadFile'/> <function line='66' file='parser' name='xmlCleanupParser'/> <macro line='61' file='xmlversion' name='LIBXML_TEST_VERSION'/> <function line='44' file='tree' name='xmlFreeDoc'/> <typedef line='26' file='tree' name='xmlDocPtr'/> <function line='70' file='xmlmemory' name='xmlMemoryDump'/> </uses> </example> <example filename='parse3.c'> <synopsis>Parse an XML document in memory to a tree and free it</synopsis> <purpose>Demonstrate the use of xmlReadMemory() to read an XML file into a tree and and xmlFreeDoc() to free the resulting tree</purpose> <usage>parse3</usage> <test>parse3</test> <author>Daniel Veillard</author> <copy>see Copyright for the status of this software. </copy> <section>Parsing</section> <includes> <include><libxml/tree.h></include> <include><libxml/parser.h></include> </includes> <uses> <function line='33' file='parser' name='xmlReadMemory'/> <function line='58' file='xmlmemory' name='xmlMemoryDump'/> <function line='54' file='parser' name='xmlCleanupParser'/> <macro line='49' file='xmlversion' name='LIBXML_TEST_VERSION'/> <function line='38' file='tree' name='xmlFreeDoc'/> <typedef line='27' file='tree' name='xmlDocPtr'/> </uses> </example> <example filename='parse4.c'> <synopsis>Parse an XML document chunk by chunk to a tree and free it</synopsis> <purpose>Demonstrate the use of xmlCreatePushParserCtxt() and xmlParseChunk() to read an XML file progressively into a tree and and xmlFreeDoc() to free the resulting tree</purpose> <usage>parse4 test3.xml</usage> <test>parse4 test3.xml</test> <author>Daniel Veillard</author> <copy>see Copyright for the status of this software. </copy> <section>Parsing</section> <includes> <include><libxml/tree.h></include> <include><libxml/parser.h></include> </includes> <uses> <function line='94' file='parser' name='xmlFreeParserCtxt'/> <function line='86' file='parser' name='xmlParseChunk'/> <function line='103' file='tree' name='xmlFreeDoc'/> <function line='135' file='xmlmemory' name='xmlMemoryDump'/> <function line='67' file='parser' name='xmlCreatePushParserCtxt'/> <function line='131' file='parser' name='xmlCleanupParser'/> <macro line='120' file='xmlversion' name='LIBXML_TEST_VERSION'/> <typedef line='45' file='tree' name='xmlParserCtxtPtr'/> <typedef line='47' file='tree' name='xmlDocPtr'/> </uses> </example> <example filename='reader1.c'> <synopsis>Parse an XML file with an xmlReader</synopsis> <purpose>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.)</purpose> <usage>reader1 <filename></usage> <test>reader1 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp</test> <author>Daniel Veillard</author> <copy>see Copyright for the status of this software. </copy> <section>xmlReader</section> <includes> <include><libxml/xmlreader.h></include> </includes> <uses> <function line='44' file='xmlstring' name='xmlStrlen'/> <function line='94' file='parser' name='xmlCleanupParser'/> <function line='37' file='xmlreader' name='xmlTextReaderNodeType'/> <typedef line='59' file='xmlreader' name='xmlTextReaderPtr'/> <function line='98' file='xmlmemory' name='xmlMemoryDump'/> <function line='33' file='xmlreader' name='xmlTextReaderConstValue'/> <function line='36' file='xmlreader' name='xmlTextReaderDepth'/> <function line='69' file='xmlreader' name='xmlFreeTextReader'/> <macro line='89' file='xmlversion' name='LIBXML_TEST_VERSION'/> <function line='29' file='xmlreader' name='xmlTextReaderConstName'/> <function line='40' file='xmlreader' name='xmlTextReaderHasValue'/> <function line='67' file='xmlreader' name='xmlTextReaderRead'/> <function line='39' file='xmlreader' name='xmlTextReaderIsEmptyElement'/> <function line='62' file='xmlreader' name='xmlReaderForFile'/> </uses> </example> <example filename='reader2.c'> <synopsis>Parse and validate an XML file with an xmlReader</synopsis> <purpose>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.)</purpose> <usage>reader2 <valid_xml_filename></usage> <test>reader2 test2.xml > reader1.tmp ; diff reader1.tmp reader1.res ; rm reader1.tmp</test> <author>Daniel Veillard</author> <copy>see Copyright for the status of this software. </copy> <section>xmlReader</section> <includes> <include><libxml/xmlreader.h></include> </includes> <uses> <function line='45' file='xmlstring' name='xmlStrlen'/> <function line='38' file='xmlreader' name='xmlTextReaderNodeType'/> <typedef line='60' file='xmlreader' name='xmlTextReaderPtr'/> <function line='34' file='xmlreader' name='xmlTextReaderConstValue'/> <enum line='70' file='parser' name='XML_PARSE_NOENT'/> <function line='37' file='xmlreader' name='xmlTextReaderDepth'/> <enum line='71' file='parser' name='XML_PARSE_DTDVALID'/> <enum line='69' file='parser' name='XML_PARSE_DTDATTR'/> <function line='84' file='xmlreader' name='xmlFreeTextReader'/> <function line='30' file='xmlreader' name='xmlTextReaderConstName'/> <function line='41' file='xmlreader' name='xmlTextReaderHasValue'/> <function line='76' file='xmlreader' name='xmlTextReaderRead'/> <function line='40' file='xmlreader' name='xmlTextReaderIsEmptyElement'/> <function line='68' file='xmlreader' name='xmlReaderForFile'/> <function line='81' file='xmlreader' name='xmlTextReaderIsValid'/> </uses> </example> <example filename='reader3.c'> <synopsis>Show how to extract subdocuments with xmlReader</synopsis> <purpose>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.)</purpose> <usage>reader3</usage> <test>reader3 > reader3.tmp ; diff reader3.tmp reader3.res ; rm reader3.tmp</test> <author>Daniel Veillard</author> <copy>see Copyright for the status of this software. </copy> <section>xmlReader</section> <includes> <include><libxml/xmlreader.h></include> </includes> <uses> <typedef line='31' file='xmlreader' name='xmlTextReaderPtr'/> <function line='65' file='xmlreader' name='xmlFreeTextReader'/> <function line='95' file='tree' name='xmlDocDump'/> <function line='51' file='xmlreader' name='xmlTextReaderRead'/> <function line='61' file='xmlreader' name='xmlTextReaderCurrentDoc'/> <function line='42' file='xmlreader' name='xmlTextReaderPreservePattern'/> <function line='37' file='xmlreader' name='xmlReaderForFile'/> </uses> </example> <example filename='reader4.c'> <synopsis>Parse multiple XML files reusing an xmlReader</synopsis> <purpose>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.)</purpose> <usage>reader4 <filename> [ filename ... ]</usage> <test>reader4 test1.xml test2.xml test3.xml > reader4.tmp ; diff reader4.tmp reader4.res ; rm reader4.tmp</test> <author>Graham Bennett</author> <copy>see Copyright for the status of this software. </copy> <section>xmlReader</section> <includes> <include><libxml/xmlreader.h></include> </includes> <uses> <typedef line='54' file='xmlreader' name='xmlTextReaderPtr'/> <function line='83' file='xmlreader' name='xmlReaderNewFile'/> <function line='104' file='xmlreader' name='xmlFreeTextReader'/> <function line='26' file='xmlreader' name='xmlTextReaderRead'/> <function line='97' file='xmlreader' name='xmlTextReaderCurrentDoc'/> <function line='72' file='xmlreader' name='xmlReaderForFile'/> </uses> </example> <example filename='testWriter.c'> <synopsis>use various APIs for the xmlWriter</synopsis> <purpose>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.</purpose> <usage>testWriter</usage> <test>testWriter ; for i in 1 2 3 4 ; do diff writer.xml writer$$i.res ; done ; rm writer*.res</test> <author>Alfred Mickautsch</author> <copy>see Copyright for the status of this software. </copy> <section>xmlWriter</section> <includes> <include><libxml/encoding.h></include> <include><libxml/xmlwriter.h></include> </includes>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -