{"id":123,"date":"2025-11-24T11:56:57","date_gmt":"2025-11-24T03:56:57","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=123"},"modified":"2025-11-24T11:56:57","modified_gmt":"2025-11-24T03:56:57","slug":"%e7%ae%80%e5%8d%95%e4%ba%86%e8%a7%a3xml%e4%b8%ad%e7%9a%84%e5%91%bd%e5%90%8d%e7%a9%ba%e9%97%b4","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2025\/11\/24\/%e7%ae%80%e5%8d%95%e4%ba%86%e8%a7%a3xml%e4%b8%ad%e7%9a%84%e5%91%bd%e5%90%8d%e7%a9%ba%e9%97%b4\/","title":{"rendered":"\u7b80\u5355\u4e86\u89e3XML\u4e2d\u7684\u547d\u540d\u7a7a\u95f4"},"content":{"rendered":"\n<p>\u4e0b\u9762\u7ed9\u4f60\u4e00\u4efd <strong>\u901a\u4fd7\u6613\u61c2\u3001\u975e\u5e38\u9002\u5408\u521d\u5b66\u8005\u7684\u300aXML \u547d\u540d\u7a7a\u95f4\u57fa\u7840\u5165\u95e8\u300b<\/strong>\uff0c3 \u5206\u949f\u5c31\u80fd\u641e\u61c2\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udcd8 XML \u4e2d\u7684\u547d\u540d\u7a7a\u95f4\uff08Namespace\uff09\u7b80\u5355\u4e86\u89e3<\/h1>\n\n\n\n<p>XML \u53ef\u4ee5\u81ea\u5b9a\u4e49\u6807\u7b7e\uff0c\u8fd9\u867d\u7136\u7075\u6d3b\uff0c\u4f46\u4e5f\u5e26\u6765\u4e00\u4e2a\u95ee\u9898\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u4e0d\u540c\u7cfb\u7edf\u53ef\u80fd\u4f1a\u4f7f\u7528\u76f8\u540c\u7684\u6807\u7b7e\u540d\uff0c\u5bfc\u81f4\u51b2\u7a81\u3002<\/strong><\/p>\n<\/blockquote>\n\n\n\n<p>\u547d\u540d\u7a7a\u95f4\uff08Namespace\uff09\u5c31\u662f\u4e3a\u4e86\u89e3\u51b3\u201c\u6807\u7b7e\u91cd\u540d\u201d\u7684\u95ee\u9898\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">1. \u4e3a\u4ec0\u4e48\u9700\u8981\u547d\u540d\u7a7a\u95f4\uff1f<\/h1>\n\n\n\n<p>\u5047\u8bbe\u6709\u4e24\u4e2a XML \u7247\u6bb5\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;Title&gt;\u4eba\u7c7b\u7b80\u53f2&amp;lt;\/Title&gt;\n\n<\/pre><\/div>\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;Title&gt;\u54c8\u5229\u6ce2\u7279&amp;lt;\/Title&gt;\n\n<\/pre><\/div>\n\n\n<p>\u5982\u679c\u628a\u5b83\u4eec\u653e\u5728\u540c\u4e00\u6587\u6863\u4e2d\uff0c\u7a0b\u5e8f\u53ef\u80fd\u65e0\u6cd5\u533a\u5206\u54ea\u4e00\u4e2a\u662f \u201c\u4e66\u540d\u201d\uff0c\u54ea\u4e00\u4e2a\u662f \u201c\u7535\u5f71\u6807\u9898\u201d\u3002<\/p>\n\n\n\n<p><strong>\u547d\u540d\u7a7a\u95f4 = \u7ed9\u6807\u7b7e\u52a0\u524d\u7f00\uff0c\u7528\u6765\u533a\u5206\u6765\u6e90\u3002<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">2. \u547d\u540d\u7a7a\u95f4\u7684\u4f7f\u7528\u65b9\u6cd5<\/h1>\n\n\n\n<p>\u547d\u540d\u7a7a\u95f4\u4e00\u822c\u8fd9\u6837\u58f0\u660e\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxmlns=&quot;http:\/\/example.com\/book&quot;\n\n<\/pre><\/div>\n\n\n<p>\u6216\u8005\u5e26\u4e00\u4e2a\u524d\u7f00\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxmlns:bk=&quot;http:\/\/example.com\/book&quot;\n\n<\/pre><\/div>\n\n\n<p>\u5176\u4e2d\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>xmlns<\/strong>\uff1aXML Namespace \u7684\u7f29\u5199<\/li>\n\n\n\n<li><strong>bk<\/strong>\uff1a\u547d\u540d\u7a7a\u95f4\u524d\u7f00<\/li>\n\n\n\n<li><strong>URL<\/strong>\uff1a\u4ec5\u4f5c\u4e3a\u552f\u4e00\u6807\u8bc6\u7b26\uff0c\u4e0d\u4e00\u5b9a\u771f\u7684\u8bbf\u95ee<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">3. \u5b9e\u9645\u793a\u4f8b\uff1a\u4e3a\u6807\u7b7e\u52a0\u4e0a\u524d\u7f00<\/h1>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;Bookstore xmlns:bk=&quot;http:\/\/example.com\/book&quot;&gt;\n    &amp;lt;bk:Book&gt;\n        &amp;lt;bk:Title&gt;\u4eba\u7c7b\u7b80\u53f2&amp;lt;\/bk:Title&gt;\n    &amp;lt;\/bk:Book&gt;\n&amp;lt;\/Bookstore&gt;\n\n<\/pre><\/div>\n\n\n<p>\u8fd9\u91cc\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>&lt;bk:Book><\/code> \u5c5e\u4e8e <code>http:\/\/example.com\/book<\/code> \u547d\u540d\u7a7a\u95f4<\/li>\n\n\n\n<li>\u4efb\u4f55\u5e26 <code>bk:<\/code> \u524d\u7f00\u7684\u6807\u7b7e\u90fd\u662f\u540c\u4e00\u4e2a\u201c\u547d\u540d\u7a7a\u95f4\u4e0b\u7684\u6807\u7b7e\u201d<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">4. \u9ed8\u8ba4\u547d\u540d\u7a7a\u95f4\uff08\u4e0d\u7528\u5199\u524d\u7f00\uff09<\/h1>\n\n\n\n<p>\u5982\u679c\u4f60\u4e0d\u60f3\u6bcf\u4e2a\u6807\u7b7e\u90fd\u5199\u524d\u7f00\uff0c\u53ef\u4ee5\u4f7f\u7528\u9ed8\u8ba4\u547d\u540d\u7a7a\u95f4\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;Bookstore xmlns=&quot;http:\/\/example.com\/book&quot;&gt;\n    &amp;lt;Book&gt;\n        &amp;lt;Title&gt;\u4eba\u7c7b\u7b80\u53f2&amp;lt;\/Title&gt;\n    &amp;lt;\/Book&gt;\n&amp;lt;\/Bookstore&gt;\n\n<\/pre><\/div>\n\n\n<p>\u8fd9\u91cc\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6240\u6709\u5b50\u6807\u7b7e <strong>\u81ea\u52a8\u5c5e\u4e8e<\/strong> <code>http:\/\/example.com\/book<\/code> \u547d\u540d\u7a7a\u95f4<\/li>\n\n\n\n<li>\u7701\u53bb\u5199\u524d\u7f00\uff0c\u66f4\u7b80\u6d01<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">5. \u591a\u547d\u540d\u7a7a\u95f4\u5e76\u5b58\uff08\u5e38\u89c1\u60c5\u51b5\uff09<\/h1>\n\n\n\n<p>XML \u6587\u6863\u7ecf\u5e38\u9700\u8981\u7ec4\u5408\u4e0d\u540c\u6765\u6e90\u7684\u6570\u636e\u3002<\/p>\n\n\n\n<p>\u4f8b\u5982\u540c\u65f6\u4f7f\u7528\u4e66\u672c\u548c\u7535\u5f71\u547d\u540d\u7a7a\u95f4\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;Items \n    xmlns:bk=&quot;http:\/\/example.com\/book&quot;\n    xmlns:mv=&quot;http:\/\/example.com\/movie&quot;&gt;\n\n    &amp;lt;bk:Title&gt;\u4eba\u7c7b\u7b80\u53f2&amp;lt;\/bk:Title&gt;\n    &amp;lt;mv:Title&gt;\u661f\u9645\u7a7f\u8d8a&amp;lt;\/mv:Title&gt;\n\n&amp;lt;\/Items&gt;\n\n<\/pre><\/div>\n\n\n<p>\u4e24\u4e2a\u7cfb\u7edf\u90fd\u7528\u4e86 <code>&lt;Title&gt;<\/code> \uff0c\u4f46\u524d\u7f00\u533a\u5206\u4e86\u5b83\u4eec\u7684\u542b\u4e49\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">6. \u547d\u540d\u7a7a\u95f4\u5e76\u975e\u7528\u4e8e\u8bbf\u95ee URL<\/h1>\n\n\n\n<p>\u547d\u540d\u7a7a\u95f4\u7684 URL \u5e38\u5e38\u53ea\u662f\u4e00\u4e2a <strong>\u552f\u4e00\u6807\u8bc6\u7b26<\/strong>\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nhttp:\/\/example.com\/book\n\n<\/pre><\/div>\n\n\n<p>\u5b83\u4e0d\u4e00\u5b9a\u80fd\u8bbf\u95ee\uff0c\u4e5f\u4e0d\u8981\u6c42\u8bbf\u95ee\u3002\u53ea\u662f\u7528\u6765\u533a\u5206\u4e0d\u540c\u7ec4\u7ec7\/\u7cfb\u7edf\u7684\u6807\u7b7e\u800c\u5df2\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">7. \u7a0b\u5e8f\u5982\u4f55\u8bc6\u522b\u547d\u540d\u7a7a\u95f4\uff1f<\/h1>\n\n\n\n<p>\u67d0\u4e9b\u89e3\u6790\u5e93\uff08Java DOM\u3001XPath\u3001LXML\uff09\u5728\u89e3\u6790\u65f6\u9700\u8981\u4f60\u6307\u5b9a\u547d\u540d\u7a7a\u95f4\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nXPath xpath = XPathFactory.newInstance().newXPath();\nMap&amp;lt;String, String&gt; ns = new HashMap&amp;lt;&gt;();\nns.put(&quot;bk&quot;, &quot;http:\/\/example.com\/book&quot;);\n\n<\/pre><\/div>\n\n\n<p>\u5426\u5219\u4f60\u67e5\u627e <code>&lt;bk:Title&gt;<\/code> \u4f1a\u627e\u4e0d\u5230\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udccc \u603b\u7ed3\uff1a\u547d\u540d\u7a7a\u95f4\u4e00\u53e5\u8bdd\u6982\u62ec<\/h1>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u547d\u540d\u7a7a\u95f4\u5c31\u662f\u201c\u7ed9\u6807\u7b7e\u52a0\u59d3\u6c0f\u201d\uff0c\u907f\u514d XML \u4e2d\u4e0d\u540c\u6765\u6e90\u7684\u76f8\u540c\u6807\u7b7e\u540d\u51b2\u7a81\u3002<\/strong><\/p>\n<\/blockquote>\n\n\n\n<p>\u4f60\u53ea\u9700\u8981\u8bb0\u4f4f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>xmlns=\"\u2026\"<\/code> \u2192 \u9ed8\u8ba4\u547d\u540d\u7a7a\u95f4<\/li>\n\n\n\n<li><code>xmlns:\u524d\u7f00=\"\u2026\"<\/code> \u2192 \u5e26\u524d\u7f00\u547d\u540d\u7a7a\u95f4<\/li>\n\n\n\n<li><code>&lt;\u524d\u7f00:\u6807\u7b7e><\/code> \u2192 \u5c5e\u4e8e\u54ea\u4e2a\u547d\u540d\u7a7a\u95f4<\/li>\n<\/ul>\n\n\n\n<p>\u597d\u7684\uff01\u8fd9\u91cc\u7ed9\u4f60\u51c6\u5907\u4e86\u4e00\u4efd<strong>\u6e05\u6670\u3001\u7d27\u51d1\u3001\u975e\u5e38\u5b9e\u7528\u7684\u300aXML \u547d\u540d\u7a7a\u95f4\u901f\u67e5\u8868\u300b<\/strong>\uff0c\u9002\u5408\u968f\u65f6\u5feb\u901f\u67e5\u9605\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udcd8 XML \u547d\u540d\u7a7a\u95f4\u901f\u67e5\u8868\uff08Cheat Sheet\uff09<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">1. \u547d\u540d\u7a7a\u95f4\u7684\u4f5c\u7528\uff08\u4e00\u53e5\u8bdd\uff09<\/h2>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>\u7ed9\u6807\u7b7e\u52a0\u201c\u59d3\u6c0f\u201d\uff0c\u907f\u514d\u4e0d\u540c XML \u6807\u7b7e\u540d\u79f0\u51b2\u7a81\u3002<\/strong><\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">2. \u547d\u540d\u7a7a\u95f4\u7684\u51e0\u79cd\u58f0\u660e\u65b9\u5f0f<\/h1>\n\n\n\n<h3 class=\"wp-block-heading\">\u2714 \u9ed8\u8ba4\u547d\u540d\u7a7a\u95f4\uff08\u4e0d\u5e26\u524d\u7f00\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;Bookstore xmlns=&quot;http:\/\/example.com\/book&quot;&gt;\n    &amp;lt;Book&gt;...&amp;lt;\/Book&gt;\n&amp;lt;\/Bookstore&gt;\n\n<\/pre><\/div>\n\n\n<p>**\u4f5c\u7528\uff1a**\u8be5\u5143\u7d20\u53ca\u6240\u6709\u5b50\u5143\u7d20\u81ea\u52a8\u5c5e\u4e8e\u8fd9\u4e2a\u547d\u540d\u7a7a\u95f4\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u2714 \u5e26\u524d\u7f00\u547d\u540d\u7a7a\u95f4\uff08\u63a8\u8350\u65b9\u5f0f\uff09<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxmlns:bk=&quot;http:\/\/example.com\/book&quot;\n\n<\/pre><\/div>\n\n\n<p>\u4f7f\u7528\u65f6\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;bk:Book&gt;...&amp;lt;\/bk:Book&gt;\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">3. \u591a\u547d\u540d\u7a7a\u95f4\u5e76\u5b58<\/h2>\n\n\n\n<p>\u5e38\u89c1\u4e8e\u590d\u5408 XML\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;Items \n    xmlns:bk=&quot;http:\/\/example.com\/book&quot;\n    xmlns:mv=&quot;http:\/\/example.com\/movie&quot;&gt;\n\n    &amp;lt;bk:Title&gt;\u4eba\u7c7b\u7b80\u53f2&amp;lt;\/bk:Title&gt;\n    &amp;lt;mv:Title&gt;\u661f\u9645\u7a7f\u8d8a&amp;lt;\/mv:Title&gt;\n&amp;lt;\/Items&gt;\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">4. \u547d\u540d\u7a7a\u95f4\u5728\u6807\u7b7e\u4e2d\u7684\u4f4d\u7f6e<\/h2>\n\n\n\n<p>\u547d\u540d\u7a7a\u95f4\u5fc5\u987b\u653e\u5728\u201c\u5f00\u59cb\u6807\u7b7e\u201d\u4e2d\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;Bookstore xmlns:bk=&quot;http:\/\/example.com\/book&quot;&gt;\n\n<\/pre><\/div>\n\n\n<p>\u4e0d\u80fd\u5199\u5728\u7ed3\u675f\u6807\u7b7e\u4e2d\uff0c\u4e5f\u4e0d\u80fd\u5199\u5728\u6ce8\u91ca\u91cc\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">5. \u547d\u540d\u7a7a\u95f4\u7684\u67e5\u627e\u8303\u56f4\uff08\u7ee7\u627f\u89c4\u5219\uff09<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u58f0\u660e\u5728\u67d0\u4e2a\u5143\u7d20\u4e0a\uff0c<\/li>\n\n\n\n<li><strong>\u6240\u6709\u5b50\u8282\u70b9\u81ea\u52a8\u7ee7\u627f<\/strong>\u8be5\u547d\u540d\u7a7a\u95f4\uff0c<\/li>\n\n\n\n<li>\u9664\u975e\u5b50\u8282\u70b9\u81ea\u5df1\u91cd\u65b0\u58f0\u660e\u53e6\u4e00\u4e2a\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4f8b\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;a xmlns=&quot;A&quot;&gt;\n    &amp;lt;b&gt;\u5c5e\u4e8e A&amp;lt;\/b&gt;\n    &amp;lt;c xmlns=&quot;B&quot;&gt;\n        &amp;lt;d&gt;\u5c5e\u4e8e B&amp;lt;\/d&gt;\n    &amp;lt;\/c&gt;\n&amp;lt;\/a&gt;\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">6. \u547d\u540d\u7a7a\u95f4 URI \u5e76\u4e0d\u9700\u8981\u80fd\u8bbf\u95ee<\/h1>\n\n\n\n<p>\u201c<a href=\"http:\/\/example.com\/book%E2%80%9D\">http:\/\/example.com\/book\u201d<\/a><br>\u53ea\u662f<strong>\u552f\u4e00\u6807\u8bc6\u7b26<\/strong>\uff0c\u4e0d\u9700\u8981\u8bbf\u95ee\uff0c\u4e5f\u4e0d\u4f1a\u4e0b\u8f7d\u4efb\u4f55\u4e1c\u897f\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">7. \u7a0b\u5e8f\u4e2d\u5982\u4f55\u5904\u7406\u547d\u540d\u7a7a\u95f4\uff08XPath \u793a\u4f8b\uff09<\/h1>\n\n\n\n<p>\u6709\u547d\u540d\u7a7a\u95f4\u65f6\uff0cXPath \u5fc5\u987b\u4f7f\u7528\u524d\u7f00\u624d\u80fd\u627e\u5230\u5143\u7d20\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u274c \u9519\u8bef\uff1a<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/Bookstore\/Book\/Title\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">\u2714 \u6b63\u786e\uff1a<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/bk:Bookstore\/bk:Book\/bk:Title\n\n<\/pre><\/div>\n\n\n<p>\u5e76\u5728\u4ee3\u7801\u4e2d\u7ed1\u5b9a\u547d\u540d\u7a7a\u95f4\uff1a<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Java XPath \u793a\u4f8b<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nXPath xpath = XPathFactory.newInstance().newXPath();\nNamespaceContext ns = prefix -&gt; {\n    if (&quot;bk&quot;.equals(prefix)) return &quot;http:\/\/example.com\/book&quot;;\n    return null;\n};\nxpath.setNamespaceContext(ns);\n\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">Python lxml \u793a\u4f8b<\/h3>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nroot.findall(&quot;.\/\/bk:Title&quot;, namespaces={\n    &quot;bk&quot;: &quot;http:\/\/example.com\/book&quot;\n})\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">8. \u5e38\u89c1\u547d\u540d\u7a7a\u95f4\u9519\u8bef\uff08\u521d\u5b66\u8005\u5bb9\u6613\u8e29\u5751\uff09<\/h1>\n\n\n\n<h3 class=\"wp-block-heading\">\u274c \u5ffd\u7565\u547d\u540d\u7a7a\u95f4\u5bfc\u81f4\u5143\u7d20\u67e5\u4e0d\u5230<\/h3>\n\n\n\n<p>XPath \u6216\u89e3\u6790 API \u4e0d\u6307\u5b9a namespace \u4f1a\u201c\u8fd4\u56de\u7a7a\u201d\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u274c \u628a URL \u5f53\u6210\u7f51\u9875\u8bbf\u95ee<\/h3>\n\n\n\n<p>\u8fd9\u662f\u5e38\u89c1\u8bef\u89e3\uff0c\u53ea\u662f\u201c\u552f\u4e00\u6807\u8bc6\u7b26\u201d\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">\u274c \u5fd8\u8bb0\u7ed9\u524d\u7f00\u52a0\u5192\u53f7<\/h3>\n\n\n\n<p>\u6b63\u786e\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;bk:Book&gt;\n\n<\/pre><\/div>\n\n\n<p>\u9519\u8bef\uff1a<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;bkBook&gt;\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">9. \u771f\u5b9e\u9879\u76ee\u4e2d\u5e38\u89c1\u7684\u547d\u540d\u7a7a\u95f4<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">\u2714 Android XML<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxmlns:android=&quot;http:\/\/schemas.android.com\/apk\/res\/android&quot;\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u2714 Spring XML<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxmlns:context=&quot;http:\/\/www.springframework.org\/schema\/context&quot;\nxmlns:mvc=&quot;http:\/\/www.springframework.org\/schema\/mvc&quot;\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u2714 SOAP WebService<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxmlns:soap=&quot;http:\/\/schemas.xmlsoap.org\/soap\/envelope\/&quot;\n\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">\u2714 Office \u6587\u6863\uff08docx \u672c\u8d28\u662f XML\uff09<\/h2>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nxmlns:w=&quot;http:\/\/schemas.openxmlformats.org\/wordprocessingml\/2006\/main&quot;\n\n<\/pre><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">\ud83d\udccc \u6700\u7ec8\u603b\u7ed3\uff08\u7edd\u5bf9\u591f\u7528\u4e86\uff09<\/h1>\n\n\n\n<p><strong>\u4f60\u53ea\u8981\u8bb0\u4f4f\u56db\u70b9\uff1a<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>xmlns=\"...\"<\/code> \u2192 \u9ed8\u8ba4\u547d\u540d\u7a7a\u95f4<\/li>\n\n\n\n<li><code>xmlns:\u524d\u7f00=\"...\"<\/code> \u2192 \u5e26\u524d\u7f00\u547d\u540d\u7a7a\u95f4<\/li>\n\n\n\n<li><code>&lt;\u524d\u7f00:\u6807\u7b7e><\/code> \u2192 \u4f7f\u7528\u67d0\u547d\u540d\u7a7a\u95f4\u7684\u5143\u7d20<\/li>\n\n\n\n<li>\u505a XPath \/ \u7f16\u7a0b\u5904\u7406\u65f6\u5fc5\u987b\u201c\u7ed1\u5b9a\u547d\u540d\u7a7a\u95f4\u201d<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u7ed9\u4f60\u4e00\u4efd \u901a\u4fd7\u6613\u61c2\u3001\u975e\u5e38\u9002\u5408\u521d\u5b66\u8005\u7684\u300aXML \u547d\u540d\u7a7a\u95f4\u57fa\u7840\u5165\u95e8\u300b\uff0c3 \u5206\u949f\u5c31&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2025\/11\/24\/%e7%ae%80%e5%8d%95%e4%ba%86%e8%a7%a3xml%e4%b8%ad%e7%9a%84%e5%91%bd%e5%90%8d%e7%a9%ba%e9%97%b4\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry","category-xml-xslt"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=123"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/123\/revisions"}],"predecessor-version":[{"id":124,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/123\/revisions\/124"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}