{"id":295702,"date":"2024-05-20T15:42:06","date_gmt":"2024-05-20T07:42:06","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/295702.html"},"modified":"2024-05-20T15:42:33","modified_gmt":"2024-05-20T07:42:33","slug":"python3-%e5%a6%82%e4%bd%95%e8%af%bb%e5%86%99-xml-%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/295702.html","title":{"rendered":"python3 \u5982\u4f55\u8bfb\u5199 xml \u6587\u4ef6"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27143026\/0aa3a9a5-93a4-4ee3-9839-08a75db1d527.webp\" alt=\"python3 \u5982\u4f55\u8bfb\u5199 xml \u6587\u4ef6\" \/><\/p>\n<p><p>\u5728Python3\u4e2d\uff0c\u8bfb\u5199XML\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5176\u4e2d\u5305\u62ec<strong>\u4f7f\u7528\u6807\u51c6\u5e93\u4e2d\u7684xml.etree.ElementTree\u3001\u4f7f\u7528lxml\u5e93\u3001\u4ee5\u53ca\u4f7f\u7528minidom<\/strong>\u3002\u8fd9\u4e9b\u6280\u672f\u5404\u5177\u7279\u8272\uff0c\u80fd\u591f\u6ee1\u8db3\u4e0d\u540c\u7684\u5e94\u7528\u9700\u6c42\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f7f\u7528xml.etree.ElementTree<\/h3>\n<\/p>\n<p><p><strong>xml.etree.ElementTree<\/strong>\u662fPython\u6807\u51c6\u5e93\u4e2d\u7684\u4e00\u4e2a\u7b80\u5355\u800c\u5f3a\u5927\u7684API\uff0c\u5b83\u63d0\u4f9b\u4e86\u8f7b\u677e\u8bfb\u53d6\u3001\u521b\u5efa\u548c\u4fee\u6539XML\u6587\u4ef6\u7684\u80fd\u529b\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u5927\u591a\u6570\u5e38\u89c1\u7684XML\u5904\u7406\u4efb\u52a1\uff0c\u7279\u522b\u662f\u5728\u6027\u80fd\u548c\u6613\u7528\u6027\u4e4b\u95f4\u5bfb\u6c42\u5e73\u8861\u65f6\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u6765\u770b\u5982\u4f55\u4f7f\u7528xml.etree.ElementTree\u8bfb\u53d6XML\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import xml.etree.ElementTree as ET<\/p>\n<h2><strong>\u8bfb\u53d6XML\u6587\u4ef6<\/strong><\/h2>\n<p>tree = ET.parse(&#039;example.xml&#039;)<\/p>\n<p>root = tree.getroot()<\/p>\n<h2><strong>\u904d\u5386XML\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u5143\u7d20<\/strong><\/h2>\n<p>for elem in root:<\/p>\n<p>    print(elem.tag, elem.attrib, elem.text)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u9996\u5148\u5bfc\u5165ElementTree\u6a21\u5757\uff0c\u7136\u540e\u4f7f\u7528<code>parse()<\/code>\u51fd\u6570\u52a0\u8f7dXML\u6587\u4ef6\u3002\u901a\u8fc7\u83b7\u53d6\u6839\u5143\u7d20<code>root<\/code>\uff0c\u6211\u4eec\u53ef\u4ee5\u904d\u5386\u548c\u8bbf\u95eeXML\u6587\u6863\u7684\u5404\u4e2a\u90e8\u5206\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u5c55\u73b0\u5982\u4f55\u4f7f\u7528xml.etree.ElementTree\u5199\u5165XML\u6587\u4ef6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import xml.etree.ElementTree as ET<\/p>\n<h2><strong>\u521b\u5efa\u6839\u5143\u7d20<\/strong><\/h2>\n<p>root = ET.Element(&quot;Root&quot;)<\/p>\n<h2><strong>\u521b\u5efa\u5b50\u5143\u7d20\u5e76\u6dfb\u52a0\u6570\u636e<\/strong><\/h2>\n<p>child1 = ET.SubElement(root, &quot;Child1&quot;)<\/p>\n<p>child1.text = &quot;Value1&quot;<\/p>\n<p>child2 = ET.SubElement(root, &quot;Child2&quot;)<\/p>\n<p>child2.text = &quot;Value2&quot;<\/p>\n<h2><strong>\u521b\u5efa\u6811\u5bf9\u8c61\u5e76\u5199\u5165\u6587\u4ef6<\/strong><\/h2>\n<p>tree = ET.ElementTree(root)<\/p>\n<p>tree.write(&quot;output.xml&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u5c55\u793a\u4e86\u5982\u4f55\u521b\u5efa\u4e00\u4e2aXML\u6587\u4ef6\uff0c\u4ece\u521b\u5efa\u6839\u5143\u7d20\u5f00\u59cb\uff0c\u7136\u540e\u6dfb\u52a0\u5b50\u5143\u7d20\uff0c\u5e76\u6700\u540e\u5199\u5165\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528lxml\u5e93<\/h3>\n<\/p>\n<p><p><strong>lxml<\/strong>\u662f\u4e00\u4e2a\u975e\u5e38\u5f3a\u5927\u7684Python\u5e93\uff0c\u7528\u4e8e\u5904\u7406XML\u548cHTML\uff0c\u5b83\u63d0\u4f9b\u4e86\u66f4\u9ad8\u7ea7\u7684\u7279\u6027\uff0c\u5982XPath\u3001XSLT\u548cSchema\u9a8c\u8bc1\u3002<\/p>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4f7f\u7528lxml\u5e93\u8bfb\u53d6XML\u6587\u4ef6\u7684\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from lxml import etree<\/p>\n<h2><strong>\u8bfb\u53d6XML\u6587\u4ef6<\/strong><\/h2>\n<p>tree = etree.parse(&quot;example.xml&quot;)<\/p>\n<p>root = tree.getroot()<\/p>\n<h2><strong>\u4f7f\u7528XPath\u9009\u62e9\u7279\u5b9a\u5143\u7d20<\/strong><\/h2>\n<p>for elem in tree.xpath(&quot;\/\/Tagname[@attribute=&#039;value&#039;]&quot;):<\/p>\n<p>    print(elem.text)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u91cc\u7684<code>etree.parse()<\/code>\u51fd\u6570\u7528\u6765\u52a0\u8f7dXML\u6587\u4ef6\uff0c<code>xpath<\/code>\u65b9\u6cd5\u5219\u7528\u4e8e\u6267\u884cXPath\u67e5\u8be2\uff0c\u9009\u62e9\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u7684\u5143\u7d20\u3002<\/p>\n<\/p>\n<p><p>\u5199\u5165XML\u6587\u4ef6\u65f6\uff0clxml\u4e5f\u5c55\u73b0\u51fa\u4e86\u5176\u7075\u6d3b\u6027\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from lxml import etree<\/p>\n<h2><strong>\u521b\u5efa\u6839\u5143\u7d20<\/strong><\/h2>\n<p>root = etree.Element(&quot;Root&quot;)<\/p>\n<h2><strong>\u521b\u5efa\u5b50\u5143\u7d20<\/strong><\/h2>\n<p>child1 = etree.SubElement(root, &quot;Child1&quot;)<\/p>\n<p>child1.text = &quot;Value1&quot;<\/p>\n<h2><strong>\u5c06\u6811\u5bf9\u8c61\u8f6c\u5316\u4e3a\u5b57\u7b26\u4e32<\/strong><\/h2>\n<p>xml_str = etree.tostring(root, pretty_print=True)<\/p>\n<h2><strong>\u5199\u5165\u6587\u4ef6<\/strong><\/h2>\n<p>with open(&quot;output.xml&quot;, &quot;wb&quot;) as xml_writer:<\/p>\n<p>    xml_writer.write(xml_str)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5229\u7528lxml\u5e93\uff0c\u6211\u4eec\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u521b\u5efaXML\u5143\u7d20\u5e76\u5c06\u5176\u5199\u5165\u6587\u4ef6\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528minidom<\/h3>\n<\/p>\n<p><p><strong>minidom<\/strong>\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684DOM\u5b9e\u73b0\uff0c\u9002\u7528\u4e8e\u7b80\u5355\u7684XML\u5904\u7406\u4efb\u52a1\u3002\u5c3d\u7ba1\u5176\u529f\u80fd\u6ca1\u6709xml.etree.ElementTree\u6216lxml\u5e93\u90a3\u4e48\u5f3a\u5927\uff0c\u4f46\u7531\u4e8e\u5176\u7b80\u5355\u6027\uff0c\u5bf9\u4e8e\u4e00\u4e9b\u5c0f\u578b\u9879\u76ee\u6216\u662f\u9700\u8981\u76f4\u63a5\u64cd\u4f5cXML DOM\u7684\u573a\u5408\u5f88\u6709\u7528\u3002<\/p>\n<\/p>\n<p><p>\u8bfb\u53d6XML\u6587\u4ef6\u7684\u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from xml.dom import minidom<\/p>\n<h2><strong>\u8bfb\u53d6XML\u6587\u4ef6<\/strong><\/h2>\n<p>dom = minidom.parse(&quot;example.xml&quot;)<\/p>\n<h2><strong>\u83b7\u53d6\u7279\u5b9a\u5143\u7d20<\/strong><\/h2>\n<p>items = dom.getElementsByTagName(&quot;TagName&quot;)<\/p>\n<p>for elem in items:<\/p>\n<p>    print(elem.getAttribute(&quot;attributeName&quot;))<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4ee5\u4e0a\u4ee3\u7801\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528minidom\u89e3\u6790XML\u6587\u4ef6\u5e76\u83b7\u53d6\u7279\u5b9a\u6807\u7b7e\u7684\u5143\u7d20\u3002<\/p>\n<\/p>\n<p><p>\u5199\u5165XML\u6587\u4ef6\u7684\u8fc7\u7a0b\u4e5f\u76f8\u5bf9\u7b80\u5355\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from xml.dom.minidom import Document<\/p>\n<h2><strong>\u521b\u5efa\u6587\u6863\u5bf9\u8c61<\/strong><\/h2>\n<p>doc = Document()<\/p>\n<h2><strong>\u521b\u5efa\u6839\u5143\u7d20<\/strong><\/h2>\n<p>root = doc.createElement(&quot;Root&quot;)<\/p>\n<p>doc.appendChild(root)<\/p>\n<h2><strong>\u521b\u5efa\u6587\u672c\u8282\u70b9\u5e76\u6dfb\u52a0\u5230\u6839\u5143\u7d20<\/strong><\/h2>\n<p>text = doc.createTextNode(&quot;This is a text node&quot;)<\/p>\n<p>root.appendChild(text)<\/p>\n<h2><strong>\u5c06DOM\u5bf9\u8c61\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u5e76\u5199\u5165\u6587\u4ef6<\/strong><\/h2>\n<p>with open(&quot;output.xml&quot;, &quot;w&quot;) as xml_writer:<\/p>\n<p>    xml_writer.write(doc.toxml())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u91cc\u6211\u4eec\u4f7f\u7528minidom\u7684Document\u5bf9\u8c61\u6765\u521b\u5efaXML\u6587\u6863\uff0c\u8fd9\u5305\u62ec\u6dfb\u52a0\u6839\u5143\u7d20\u548c\u6587\u672c\u8282\u70b9\uff0c\u7136\u540e\u5c06\u8fd9\u4e2aDOM\u5bf9\u8c61\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\u5199\u5165\u6587\u4ef6\u4e2d\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u4e09\u79cd\u65b9\u6cd5\uff0cPython3\u63d0\u4f9b\u4e86\u7075\u6d3b\u7684\u89e3\u51b3\u65b9\u6848\u6765\u8bfb\u5199XML\u6587\u4ef6\uff0c\u4e0d\u540c\u7684\u5e93\u548cAPI\u80fd\u591f\u6ee1\u8db3\u4e0d\u540c\u573a\u666f\u4e0b\u5bf9XML\u5904\u7406\u7684\u9700\u6c42\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>\u5982\u4f55\u4f7f\u7528Python3\u8bfb\u53d6XML\u6587\u4ef6\uff1f<\/strong><\/p>\n<p>Python3\u63d0\u4f9b\u4e86\u8bb8\u591a\u5e93\u6765\u8bfb\u53d6XML\u6587\u4ef6\uff0c\u5176\u4e2d\u6700\u5e38\u7528\u7684\u662f<code>xml.etree.ElementTree<\/code>\u6a21\u5757\u3002\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u4f7f\u7528Python3\u8bfb\u53d6XML\u6587\u4ef6\uff1a<\/p>\n<ol>\n<li>\n<p>\u9996\u5148\uff0c\u5bfc\u5165<code>xml.etree.ElementTree<\/code>\u6a21\u5757\uff1a<code>import xml.etree.ElementTree as ET<\/code><\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528<code>ET.parse()<\/code>\u51fd\u6570\u89e3\u6790XML\u6587\u4ef6\uff1a<code>tree = ET.parse(&#039;file.xml&#039;)<\/code><\/p>\n<\/li>\n<li>\n<p>\u83b7\u53d6XML\u6587\u4ef6\u7684\u6839\u5143\u7d20\uff1a<code>root = tree.getroot()<\/code><\/p>\n<\/li>\n<li>\n<p>\u901a\u8fc7\u904d\u5386\u5143\u7d20\u6811\uff0c\u83b7\u53d6XML\u6587\u4ef6\u4e2d\u7684\u6570\u636e\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528<code>find()<\/code>\u51fd\u6570\u6839\u636e\u6807\u7b7e\u540d\u79f0\u627e\u5230\u5177\u4f53\u7684\u5143\u7d20\uff1a<code>element = root.find(&#039;tagname&#039;)<\/code>\uff0c\u7136\u540e\u53ef\u4ee5\u4f7f\u7528<code>text<\/code>\u5c5e\u6027\u83b7\u53d6\u5143\u7d20\u7684\u6587\u672c\u5185\u5bb9\uff1a<code>text = element.text<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u5c31\u53ef\u4ee5\u5728Python\u4e2d\u6210\u529f\u8bfb\u53d6XML\u6587\u4ef6\u7684\u5185\u5bb9\u4e86\u3002<\/p>\n<p><strong>Python3\u5982\u4f55\u5c06\u6570\u636e\u5199\u5165XML\u6587\u4ef6\uff1f<\/strong><\/p>\n<p>\u8981\u5c06\u6570\u636e\u5199\u5165XML\u6587\u4ef6\uff0cPython3\u540c\u6837\u63d0\u4f9b\u4e86<code>xml.etree.ElementTree<\/code>\u6a21\u5757\u7684\u76f8\u5173\u51fd\u6570\u3002\u4ee5\u4e0b\u662f\u5c06\u6570\u636e\u5199\u5165XML\u6587\u4ef6\u7684\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\n<p>\u9996\u5148\uff0c\u521b\u5efaXML\u6587\u4ef6\u7684\u6839\u5143\u7d20\uff1a<code>root = ET.Element(&#039;root&#039;)<\/code><\/p>\n<\/li>\n<li>\n<p>\u521b\u5efa\u5b50\u5143\u7d20\uff0c\u5e76\u5c06\u5176\u6dfb\u52a0\u5230\u6839\u5143\u7d20\u4e2d\uff1a<code>child = ET.SubElement(root, &#039;child&#039;)<\/code><\/p>\n<\/li>\n<li>\n<p>\u5c06\u6570\u636e\u6dfb\u52a0\u5230\u5143\u7d20\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>text<\/code>\u5c5e\u6027\u8bbe\u7f6e\u5143\u7d20\u7684\u5185\u5bb9\uff1a<code>child.text = &#039;data&#039;<\/code><\/p>\n<\/li>\n<li>\n<p>\u521b\u5efa\u4e00\u4e2aElementTree\u5bf9\u8c61\uff0c\u5e76\u5c06\u6839\u5143\u7d20\u4f20\u9012\u7ed9\u5b83\uff1a<code>tree = ET.ElementTree(root)<\/code><\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528<code>tree.write()<\/code>\u51fd\u6570\u5c06\u6570\u636e\u5199\u5165XML\u6587\u4ef6\uff1a<code>tree.write(&#039;file.xml&#039;)<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u5c31\u53ef\u4ee5\u5c06\u6570\u636e\u6210\u529f\u5199\u5165XML\u6587\u4ef6\u4e86\u3002<\/p>\n<p><strong>Python3\u4e2d\u5982\u4f55\u89e3\u6790\u5305\u542b\u547d\u540d\u7a7a\u95f4\u7684XML\u6587\u4ef6\uff1f<\/strong><\/p>\n<p>\u5f53XML\u6587\u4ef6\u4e2d\u5305\u542b\u547d\u540d\u7a7a\u95f4\u65f6\uff0c\u89e3\u6790XML\u6587\u4ef6\u4f1a\u7a0d\u5fae\u590d\u6742\u4e00\u4e9b\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528Python3\u89e3\u6790\u5305\u542b\u547d\u540d\u7a7a\u95f4\u7684XML\u6587\u4ef6\u7684\u6b65\u9aa4\uff1a<\/p>\n<ol>\n<li>\n<p>\u9996\u5148\uff0c\u521b\u5efa\u4e00\u4e2a\u5b57\u5178\u6765\u5b58\u50a8\u547d\u540d\u7a7a\u95f4\u548c\u547d\u540d\u7a7a\u95f4\u7684\u524d\u7f00\uff1a<code>namespace = {&#039;prefix&#039; : &#039;namespace_uri&#039;}<\/code>\u3002\u8fd9\u91cc\u7684<code>prefix<\/code>\u662f\u60a8\u81ea\u5b9a\u4e49\u7684\u524d\u7f00\u540d\uff0c<code>namespace_uri<\/code>\u662f\u547d\u540d\u7a7a\u95f4\u7684URI\u3002<\/p>\n<\/li>\n<li>\n<p>\u5728\u4f7f\u7528<code>ET.parse()<\/code>\u51fd\u6570\u89e3\u6790XML\u6587\u4ef6\u65f6\uff0c\u4f20\u9012\u547d\u540d\u7a7a\u95f4\u5b57\u5178\u4f5c\u4e3a\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff1a<code>tree = ET.parse(&#039;file.xml&#039;, namespace)<\/code><\/p>\n<\/li>\n<li>\n<p>\u83b7\u53d6XML\u6587\u4ef6\u7684\u6839\u5143\u7d20\uff1a<code>root = tree.getroot()<\/code><\/p>\n<\/li>\n<li>\n<p>\u5728\u67e5\u627e\u5143\u7d20\u6216\u4f7f\u7528XPath\u8868\u8fbe\u5f0f\u65f6\uff0c\u9700\u8981\u5728\u6807\u7b7e\u540d\u524d\u52a0\u4e0a\u547d\u540d\u7a7a\u95f4\u524d\u7f00\u3002\u4f8b\u5982\uff0c\u4f7f\u7528<code>find()<\/code>\u51fd\u6570\u6839\u636e\u5e26\u547d\u540d\u7a7a\u95f4\u7684\u6807\u7b7e\u540d\u79f0\u627e\u5230\u5143\u7d20\uff1a<code>element = root.find(&#039;prefix:tagname&#039;, namespace)<\/code>\uff0c\u7136\u540e\u53ef\u4ee5\u4f7f\u7528<code>text<\/code>\u5c5e\u6027\u83b7\u53d6\u5143\u7d20\u7684\u6587\u672c\u5185\u5bb9\uff1a<code>text = element.text<\/code><\/p>\n<\/li>\n<\/ol>\n<p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u5c31\u53ef\u4ee5\u6210\u529f\u89e3\u6790\u5305\u542b\u547d\u540d\u7a7a\u95f4\u7684XML\u6587\u4ef6\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Python3\u4e2d\uff0c\u8bfb\u5199XML\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u5176\u4e2d\u5305\u62ec\u4f7f\u7528\u6807\u51c6\u5e93\u4e2d\u7684xml.etree.Elemen [&hellip;]","protected":false},"author":3,"featured_media":295735,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/295702"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=295702"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/295702\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/295735"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=295702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=295702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=295702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}