examples.xml

来自「图片显示,电脑光于望技术湖连望键往,网络」· XML 代码 · 共 603 行 · 第 1/2 页

XML
603
字号
<examples>  <example filename='xpath1.c'>    <synopsis>Evaluate XPath expression and prints result node set.</synopsis>    <purpose>Shows how to evaluate XPath expression and register known namespaces in XPath context.</purpose>    <usage>xpath1 &lt;xml-file&gt; &lt;xpath-expr&gt; [&lt;known-ns-list&gt;]</usage>    <author>Aleksey Sanin</author>    <copy>see Copyright for the status of this software. </copy>    <section>XPath</section>    <includes>      <include>&lt;libxml/xpath.h&gt;</include>      <include>&lt;libxml/parser.h&gt;</include>      <include>&lt;libxml/xpathInternals.h&gt;</include>      <include>&lt;libxml/tree.h&gt;</include>    </includes>    <uses>      <enum line='225' file='tree' name='XML_ELEMENT_NODE'/>      <typedef line='84' file='xpath' name='xmlXPathObjectPtr'/>      <function line='50' file='xmlmemory' name='xmlMemoryDump'/>      <function line='113' file='xpath' name='xmlXPathEvalExpression'/>      <function line='182' file='xpathInternals' name='xmlXPathRegisterNs'/>      <function line='125' file='xpath' name='xmlXPathFreeObject'/>      <typedef line='82' file='tree' name='xmlDocPtr'/>      <typedef line='214' file='tree' name='xmlNsPtr'/>      <function line='97' file='xpath' name='xmlXPathNewContext'/>      <typedef line='202' file='tree' name='xmlNodePtr'/>      <function line='45' file='parser' name='xmlCleanupParser'/>      <macro line='39' file='xmlversion' name='LIBXML_TEST_VERSION'/>      <typedef line='83' file='xpath' name='xmlXPathContextPtr'/>      <function line='126' file='xpath' name='xmlXPathFreeContext'/>      <function line='35' file='parser' name='xmlInitParser'/>      <function line='152' file='xmlstring' name='xmlStrdup'/>      <function line='127' file='tree' name='xmlFreeDoc'/>      <function line='176' file='xmlstring' name='xmlStrchr'/>      <variable line='189' file='globals' name='xmlFree'/>      <function line='90' file='parser' name='xmlParseFile'/>      <enum line='213' file='tree' name='XML_NAMESPACE_DECL'/>    </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>&lt;libxml/tree.h&gt;</include>      <include>&lt;libxml/parser.h&gt;</include>    </includes>    <uses>      <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'/>      <function line='54' file='xmlmemory' name='xmlMemoryDump'/>    </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>&lt;libxml/tree.h&gt;</include>      <include>&lt;libxml/parser.h&gt;</include>    </includes>    <uses>      <function line='47' file='parser' name='xmlFreeParserCtxt'/>      <macro line='61' file='xmlversion' name='LIBXML_TEST_VERSION'/>      <enum line='35' file='parser' name='XML_PARSE_DTDVALID'/>      <function line='29' file='parser' name='xmlNewParserCtxt'/>      <function line='66' file='parser' name='xmlCleanupParser'/>      <typedef line='25' file='tree' name='xmlParserCtxtPtr'/>      <function line='35' file='parser' name='xmlCtxtReadFile'/>      <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='tree1.c'>    <synopsis>Navigates a tree to print element names</synopsis>    <purpose>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.</purpose>    <usage>tree1 filename_or_URL</usage>    <test>tree1 test2.xml &gt; tree1.tmp ; diff tree1.tmp tree1.res ; rm tree1.tmp</test>    <author>Dodji Seketeli</author>    <copy>see Copyright for the status of this software. </copy>    <section>Tree</section>    <includes>      <include>&lt;libxml/tree.h&gt;</include>      <include>&lt;libxml/parser.h&gt;</include>    </includes>    <uses>      <function line='83' file='parser' name='xmlCleanupParser'/>      <macro line='65' file='xmlversion' name='LIBXML_TEST_VERSION'/>      <enum line='34' file='tree' name='XML_ELEMENT_NODE'/>      <function line='77' file='tree' name='xmlFreeDoc'/>      <function line='65' file='parser' name='xmlParseFile'/>      <function line='72' file='tree' name='xmlDocGetRootElement'/>    </uses>  </example>  <example filename='tree2.c'>    <synopsis>Creates a tree</synopsis>    <purpose>Shows how to create document, nodes and dump it to stdout or file.</purpose>    <usage>tree2 &lt;filename&gt;  -Default output: stdout</usage>    <test>tree2 &gt; tree2.tmp ; diff tree2.tmp tree2.res ; rm tree2.tmp</test>    <author>Lucas Brasilino &lt;brasilino@recife.pe.gov.br&gt;</author>    <copy>see Copyright for the status of this software </copy>    <section>Tree</section>    <includes>      <include>&lt;libxml/tree.h&gt;</include>      <include>&lt;libxml/parser.h&gt;</include>    </includes>    <uses>      <function line='73' file='tree' name='xmlNewText'/>      <function line='108' file='xmlmemory' name='xmlMemoryDump'/>      <function line='94' file='tree' name='xmlSaveFormatFileEnc'/>      <function line='76' file='tree' name='xmlAddChild'/>      <function line='39' file='tree' name='xmlDocSetRootElement'/>      <function line='103' file='parser' name='xmlCleanupParser'/>      <macro line='32' file='xmlversion' name='LIBXML_TEST_VERSION'/>      <function line='87' file='tree' name='xmlNewProp'/>      <function line='86' file='tree' name='xmlNewChild'/>      <function line='72' file='tree' name='xmlNewNode'/>      <function line='44' file='tree' name='xmlCreateIntSubset'/>      <function line='97' file='tree' name='xmlFreeDoc'/>      <function line='37' file='tree' name='xmlNewDoc'/>    </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>&lt;libxml/encoding.h&gt;</include>      <include>&lt;libxml/xmlwriter.h&gt;</include>    </includes>    <uses>      <function line='1109' file='xmlwriter' name='xmlTextWriterEndElement'/>      <function line='899' file='tree' name='xmlDocSetRootElement'/>      <function line='911' file='xmlwriter' name='xmlTextWriterStartDocument'/>      <function line='1119' file='xmlwriter' name='xmlTextWriterEndDocument'/>      <function line='957' file='xmlwriter' name='xmlTextWriterWriteFormatComment'/>      <function line='923' file='xmlwriter' name='xmlTextWriterWriteComment'/>      <function line='52' file='parser' name='xmlCleanupParser'/>      <variable line='1164' file='globals' name='xmlMalloc'/>      <function line='1071' file='xmlwriter' name='xmlTextWriterWriteFormatElement'/>      <function line='1154' file='encoding' name='xmlFindCharEncodingHandler'/>      <typedef line='1149' file='encoding' name='xmlCharEncodingHandlerPtr'/>      <function line='902' file='xmlwriter' name='xmlNewTextWriterTree'/>      <function line='74' file='xmlwriter' name='xmlNewTextWriterFilename'/>      <function line='1129' file='tree' name='xmlFreeDoc'/>      <typedef line='878' file='tree' name='xmlNodePtr'/>      <typedef line='877' file='tree' name='xmlDocPtr'/>      <typedef line='339' file='tree' name='xmlBufferPtr'/>      <function line='630' file='xmlwriter' name='xmlNewTextWriterDoc'/>      <function line='892' file='tree' name='xmlNewDocNode'/>      <function line='1127' file='tree' name='xmlSaveFileEnc'/>      <function line='56' file='xmlmemory' name='xmlMemoryDump'/>      <macro line='883' file='parser' name='XML_DEFAULT_VERSION'/>      <function line='353' file='xmlwriter' name='xmlNewTextWriterMemory'/>      <variable line='1178' file='globals' name='xmlFree'/>      <function line='1094' file='xmlwriter' name='xmlTextWriterStartElement'/>      <function line='1125' file='xmlwriter' name='xmlFreeTextWriter'/>      <function line='345' file='tree' name='xmlBufferCreate'/>      <macro line='38' file='xmlversion' name='LIBXML_TEST_VERSION'/>      <function line='611' file='tree' name='xmlBufferFree'/>      <typedef line='876' file='xmlwriter' name='xmlTextWriterPtr'/>      <function line='1101' file='xmlwriter' name='xmlTextWriterWriteElement'/>      <function line='947' file='xmlwriter' name='xmlTextWriterWriteAttribute'/>      <variable line='1181' file='globals' name='xmlRealloc'/>      <function line='883' file='tree' name='xmlNewDoc'/>    </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</purpose>    <usage>reader1 &lt;filename&gt;</usage>    <test>reader1 test2.xml &gt; 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>&lt;libxml/xmlreader.h&gt;</include>    </includes>    <uses>      <function line='40' file='xmlstring' name='xmlStrlen'/>      <function line='33' file='xmlreader' name='xmlTextReaderNodeType'/>      <typedef line='55' file='xmlreader' name='xmlTextReaderPtr'/>      <function line='94' file='xmlmemory' name='xmlMemoryDump'/>      <function line='29' file='xmlreader' name='xmlTextReaderConstValue'/>      <function line='32' file='xmlreader' name='xmlTextReaderDepth'/>      <function line='65' file='xmlreader' name='xmlFreeTextReader'/>      <function line='25' file='xmlreader' name='xmlTextReaderConstName'/>      <function line='36' file='xmlreader' name='xmlTextReaderHasValue'/>      <function line='63' file='xmlreader' name='xmlTextReaderRead'/>      <function line='35' file='xmlreader' name='xmlTextReaderIsEmptyElement'/>      <function line='58' 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</purpose>    <usage>reader2 &lt;valid_xml_filename&gt;</usage>    <test>reader2 test2.xml &gt; 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>&lt;libxml/xmlreader.h&gt;</include>    </includes>    <uses>      <function line='41' file='xmlstring' name='xmlStrlen'/>      <function line='34' file='xmlreader' name='xmlTextReaderNodeType'/>      <typedef line='56' file='xmlreader' name='xmlTextReaderPtr'/>      <function line='30' file='xmlreader' name='xmlTextReaderConstValue'/>      <enum line='66' file='parser' name='XML_PARSE_NOENT'/>      <function line='33' file='xmlreader' name='xmlTextReaderDepth'/>      <enum line='67' file='parser' name='XML_PARSE_DTDVALID'/>      <enum line='65' file='parser' name='XML_PARSE_DTDATTR'/>      <function line='80' file='xmlreader' name='xmlFreeTextReader'/>      <function line='26' file='xmlreader' name='xmlTextReaderConstName'/>      <function line='37' file='xmlreader' name='xmlTextReaderHasValue'/>      <function line='72' file='xmlreader' name='xmlTextReaderRead'/>      <function line='36' file='xmlreader' name='xmlTextReaderIsEmptyElement'/>      <function line='64' file='xmlreader' name='xmlReaderForFile'/>      <function line='77' 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</purpose>    <usage>reader3</usage>    <test>reader3 &gt; 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>&lt;libxml/xmlreader.h&gt;</include>    </includes>    <uses>      <typedef line='27' file='xmlreader' name='xmlTextReaderPtr'/>      <function line='33' file='xmlreader' name='xmlReaderForFile'/>      <function line='61' file='xmlreader' name='xmlFreeTextReader'/>      <function line='91' file='tree' name='xmlDocDump'/>      <function line='47' file='xmlreader' name='xmlTextReaderRead'/>      <function line='57' file='xmlreader' name='xmlTextReaderCurrentDoc'/>      <function line='38' file='xmlreader' name='xmlTextReaderPreservePattern'/>      <typedef line='72' file='tree' name='xmlDocPtr'/>    </uses>  </example>  <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 &gt; 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>&lt;libxml/parser.h&gt;</include>      <include>&lt;libxml/xinclude.h&gt;</include>      <include>&lt;libxml/tree.h&gt;</include>      <include>&lt;libxml/xmlIO.h&gt;</include>    </includes>    <uses>      <function line='139' file='tree' name='xmlDocDump'/>      <function line='132' file='xinclude' name='xmlXIncludeProcess'/>      <function line='116' file='xmlIO' name='xmlRegisterInputCallbacks'/>      <function line='123' file='parser' name='xmlReadMemory'/>      <typedef line='104' file='tree' name='xmlDocPtr'/>    </uses>  </example>  <symbols>    <symbol name='LIBXML_TEST_VERSION'>      <ref filename='xpath1.c'/>      <ref filename='parse1.c'/>      <ref filename='parse2.c'/>      <ref filename='tree1.c'/>      <ref filename='tree2.c'/>      <ref filename='testWriter.c'/>    </symbol>    <symbol name='XML_DEFAULT_VERSION'>      <ref filename='testWriter.c'/>    </symbol>    <symbol name='XML_ELEMENT_NODE'>      <ref filename='xpath1.c'/>      <ref filename='tree1.c'/>    </symbol>    <symbol name='XML_NAMESPACE_DECL'>      <ref filename='xpath1.c'/>    </symbol>    <symbol name='XML_PARSE_DTDATTR'>      <ref filename='reader2.c'/>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?