uTools-Manuals/docs/python/markup.html
2019-04-08 23:22:26 +08:00

1 line
15 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<div class="body" role="main"><div class="section" id="structured-markup-processing-tools"><h1><span class="yiyi-st" id="yiyi-9">20. </span><span class="yiyi-st" id="yiyi-10">结构化标记处理工具</span></h1><p><span class="yiyi-st" id="yiyi-11">Python支持各种模块来处理各种形式的结构化数据标记。</span><span class="yiyi-st" id="yiyi-12">这包括使用标准通用标记语言SGML和超文本标记语言HTML的模块以及使用可扩展标记语言XML的几个接口。</span></p><div class="toctree-wrapper compound"><ul><li class="toctree-l1"><span class="yiyi-st" id="yiyi-13"><a class="reference internal" href="html.html">20.1. <code class="docutils literal"><span class="pre">html</span></code> - 超文本标记语言支持</a></span></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-17"><a class="reference internal" href="html.parser.html">20.2. <code class="docutils literal"><span class="pre">html.parser</span></code> - 简单的HTML和XHTML解析器</a></span><ul><li class="toctree-l2"><span class="yiyi-st" id="yiyi-14"><a class="reference internal" href="html.parser.html#example-html-parser-application">20.2.1. HTML解析器应用程序示例</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-15"><a class="reference internal" href="html.parser.html#htmlparser-methods">20.2.2. <code class="docutils literal"><span class="pre">HTMLParser</span></code>方法</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-16"><a class="reference internal" href="html.parser.html#examples">20.2.3.示例</a></span></li></ul></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-18"><a class="reference internal" href="html.entities.html">20.3. <code class="docutils literal"><span class="pre">html.entities</span></code> - HTML一般实体的定义</a></span></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-21"><a class="reference internal" href="xml.html">20.4. XML处理模块</a></span><ul><li class="toctree-l2"><span class="yiyi-st" id="yiyi-19"><a class="reference internal" href="xml.html#xml-vulnerabilities">20.4.1. XML漏洞</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-20"><a class="reference internal" href="xml.html#the-defusedxml-and-defusedexpat-packages">20.4.2. <code class="docutils literal"><span class="pre">defusedxml</span></code><code class="docutils literal"><span class="pre">defusedexpat</span></code>套件</a></span></li></ul></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-43"><a class="reference internal" href="xml.etree.elementtree.html">20.5. <code class="docutils literal"><span class="pre">xml.etree.ElementTree</span></code> - ElementTree XML API</a></span><ul><li class="toctree-l2"><span class="yiyi-st" id="yiyi-30"><a class="reference internal" href="xml.etree.elementtree.html#tutorial">20.5.1.教程</a></span><ul><li class="toctree-l3"><span class="yiyi-st" id="yiyi-22"><a class="reference internal" href="xml.etree.elementtree.html#xml-tree-and-elements">20.5.1.1. XML树和元素</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-23"><a class="reference internal" href="xml.etree.elementtree.html#parsing-xml">20.5.1.2.解析XML</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-24"><a class="reference internal" href="xml.etree.elementtree.html#pull-api-for-non-blocking-parsing">20.5.1.3. Pull API for non-blocking parsing</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-25"><a class="reference internal" href="xml.etree.elementtree.html#finding-interesting-elements">20.5.1.4.找到有趣的元素</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-26"><a class="reference internal" href="xml.etree.elementtree.html#modifying-an-xml-file">20.5.1.5.修改XML文件</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-27"><a class="reference internal" href="xml.etree.elementtree.html#building-xml-documents">20.5.1.6.构建XML文档</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-28"><a class="reference internal" href="xml.etree.elementtree.html#parsing-xml-with-namespaces">20.5.1.7.使用命名空间解析XML</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-29"><a class="reference internal" href="xml.etree.elementtree.html#additional-resources">20.5.1.8.其他资源</a></span></li></ul></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-33"><a class="reference internal" href="xml.etree.elementtree.html#xpath-support">20.5.2. XPath支持</a></span><ul><li class="toctree-l3"><span class="yiyi-st" id="yiyi-31"><a class="reference internal" href="xml.etree.elementtree.html#example">20.5.2.1.示例</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-32"><a class="reference internal" href="xml.etree.elementtree.html#supported-xpath-syntax">20.5.2.2.支持的XPath语法</a></span></li></ul></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-42"><a class="reference internal" href="xml.etree.elementtree.html#reference">20.5.3.参考</a></span><ul><li class="toctree-l3"><span class="yiyi-st" id="yiyi-34"><a class="reference internal" href="xml.etree.elementtree.html#functions">20.5.3.1.函数</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-35"><a class="reference internal" href="xml.etree.elementtree.html#element-objects">20.5.3.2.元素对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-36"><a class="reference internal" href="xml.etree.elementtree.html#elementtree-objects">20.5.3.3. ElementTree对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-37"><a class="reference internal" href="xml.etree.elementtree.html#qname-objects">20.5.3.4. QName Objects</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-38"><a class="reference internal" href="xml.etree.elementtree.html#treebuilder-objects">20.5.3.5. TreeBuilder对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-39"><a class="reference internal" href="xml.etree.elementtree.html#xmlparser-objects">20.5.3.6. XMLParser对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-40"><a class="reference internal" href="xml.etree.elementtree.html#xmlpullparser-objects">20.5.3.7. XMLPullParser对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-41"><a class="reference internal" href="xml.etree.elementtree.html#exceptions">20.5.3.8.例外</a></span></li></ul></li></ul></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-61"><a class="reference internal" href="xml.dom.html">20.6. <code class="docutils literal"><span class="pre">xml.dom</span></code> - 文档对象模型API</a></span><ul><li class="toctree-l2"><span class="yiyi-st" id="yiyi-44"><a class="reference internal" href="xml.dom.html#module-contents">20.6.1.模块内容</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-57"><a class="reference internal" href="xml.dom.html#objects-in-the-dom">20.6.2. DOM中的对象</a></span><ul><li class="toctree-l3"><span class="yiyi-st" id="yiyi-45"><a class="reference internal" href="xml.dom.html#domimplementation-objects">20.6.2.1. DOMImplementation Objects</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-46"><a class="reference internal" href="xml.dom.html#node-objects">20.6.2.2.节点对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-47"><a class="reference internal" href="xml.dom.html#nodelist-objects">20.6.2.3. NodeList Objects</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-48"><a class="reference internal" href="xml.dom.html#documenttype-objects">20.6.2.4. DocumentType对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-49"><a class="reference internal" href="xml.dom.html#document-objects">20.6.2.5.文档对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-50"><a class="reference internal" href="xml.dom.html#element-objects">20.6.2.6.元素对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-51"><a class="reference internal" href="xml.dom.html#attr-objects">20.6.2.7. Attr对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-52"><a class="reference internal" href="xml.dom.html#namednodemap-objects">20.6.2.8. NamedNodeMap Objects</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-53"><a class="reference internal" href="xml.dom.html#comment-objects">20.6.2.9.评论对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-54"><a class="reference internal" href="xml.dom.html#text-and-cdatasection-objects">20.6.2.10.文本和CDATASection对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-55"><a class="reference internal" href="xml.dom.html#processinginstruction-objects">20.6.2.11. ProcessingInstruction对象</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-56"><a class="reference internal" href="xml.dom.html#exceptions">20.6.2.12.例外</a></span></li></ul></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-60"><a class="reference internal" href="xml.dom.html#conformance">20.6.3.一致</a></span><ul><li class="toctree-l3"><span class="yiyi-st" id="yiyi-58"><a class="reference internal" href="xml.dom.html#type-mapping">20.6.3.1.类型映射</a></span></li><li class="toctree-l3"><span class="yiyi-st" id="yiyi-59"><a class="reference internal" href="xml.dom.html#accessor-methods">20.6.3.2.存取器方法</a></span></li></ul></li></ul></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-65"><a class="reference internal" href="xml.dom.minidom.html">20.7. <code class="docutils literal"><span class="pre">xml.dom.minidom</span></code> - 最小DOM实现</a></span><ul><li class="toctree-l2"><span class="yiyi-st" id="yiyi-62"><a class="reference internal" href="xml.dom.minidom.html#dom-objects">20.7.1. DOM对象</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-63"><a class="reference internal" href="xml.dom.minidom.html#dom-example">20.7.2. DOM示例</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-64"><a class="reference internal" href="xml.dom.minidom.html#minidom-and-the-dom-standard">20.7.3. minidom和DOM标准</a></span></li></ul></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-67"><a class="reference internal" href="xml.dom.pulldom.html">20.8. <code class="docutils literal"><span class="pre">xml.dom.pulldom</span></code> - 支持构建部分DOM树</a></span><ul><li class="toctree-l2"><span class="yiyi-st" id="yiyi-66"><a class="reference internal" href="xml.dom.pulldom.html#domeventstream-objects">20.8.1. DOMEventStream对象</a></span></li></ul></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-69"><a class="reference internal" href="xml.sax.html">20.9. <code class="docutils literal"><span class="pre">xml.sax</span></code> - 支持SAX2解析器</a></span><ul><li class="toctree-l2"><span class="yiyi-st" id="yiyi-68"><a class="reference internal" href="xml.sax.html#saxexception-objects">20.9.1. SAXException对象</a></span></li></ul></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-74"><a class="reference internal" href="xml.sax.handler.html">20.10. <code class="docutils literal"><span class="pre">xml.sax.handler</span></code> - SAX处理程序的基类</a></span><ul><li class="toctree-l2"><span class="yiyi-st" id="yiyi-70"><a class="reference internal" href="xml.sax.handler.html#contenthandler-objects">20.10.1. ContentHandler对象</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-71"><a class="reference internal" href="xml.sax.handler.html#dtdhandler-objects">20.10.2. DTDHandler Objects</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-72"><a class="reference internal" href="xml.sax.handler.html#entityresolver-objects">20.10.3. EntityResolver对象</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-73"><a class="reference internal" href="xml.sax.handler.html#errorhandler-objects">20.10.4. ErrorHandler对象</a></span></li></ul></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-75"><a class="reference internal" href="xml.sax.utils.html">20.11. <code class="docutils literal"><span class="pre">xml.sax.saxutils</span></code> - SAX实用程序</a></span></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-82"><a class="reference internal" href="xml.sax.reader.html">20.12. <code class="docutils literal"><span class="pre">xml.sax.xmlreader</span></code> - XML解析器接口</a></span><ul><li class="toctree-l2"><span class="yiyi-st" id="yiyi-76"><a class="reference internal" href="xml.sax.reader.html#xmlreader-objects">20.12.1. XMLReader对象</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-77"><a class="reference internal" href="xml.sax.reader.html#incrementalparser-objects">20.12.2. IncrementalParser Objects</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-78"><a class="reference internal" href="xml.sax.reader.html#locator-objects">20.12.3.定位器对象</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-79"><a class="reference internal" href="xml.sax.reader.html#inputsource-objects">20.12.4. InputSource对象</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-80"><a class="reference internal" href="xml.sax.reader.html#the-attributes-interface">20.12.5. <code class="docutils literal"><span class="pre">Attributes</span></code>接口</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-81"><a class="reference internal" href="xml.sax.reader.html#the-attributesns-interface">20.12.6. <code class="docutils literal"><span class="pre">AttributesNS</span></code>接口</a></span></li></ul></li><li class="toctree-l1"><span class="yiyi-st" id="yiyi-88"><a class="reference internal" href="pyexpat.html">20.13. <code class="docutils literal"><span class="pre">xml.parsers.expat</span></code> - 使用Expat</a>快速进行XML解析</span><ul><li class="toctree-l2"><span class="yiyi-st" id="yiyi-83"><a class="reference internal" href="pyexpat.html#xmlparser-objects">20.13.1. XMLParser对象</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-84"><a class="reference internal" href="pyexpat.html#expaterror-exceptions">20.13.2. ExpatError异常</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-85"><a class="reference internal" href="pyexpat.html#example">20.13.3.示例</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-86"><a class="reference internal" href="pyexpat.html#module-xml.parsers.expat.model">20.13.4.内容模型说明</a></span></li><li class="toctree-l2"><span class="yiyi-st" id="yiyi-87"><a class="reference internal" href="pyexpat.html#module-xml.parsers.expat.errors">20.13.5.外显误差常数</a></span></li></ul></li></ul></div></div></div>