{"id":176,"date":"2009-01-03T10:41:00","date_gmt":"2009-01-03T02:41:00","guid":{"rendered":""},"modified":"2013-11-24T21:21:36","modified_gmt":"2013-11-24T13:21:36","slug":"xml%e8%af%ad%e6%b3%95%e8%ae%b2%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/176.html","title":{"rendered":"XML\u8bed\u6cd5\u8bb2\u89e3"},"content":{"rendered":"<p>\u4e00.XML\u8bed\u6cd5\u89c4\u5219<\/p>\n<div>\n<p>XML\u7684\u6587\u6863\u548cHTML\u7684\u539f\u4ee3\u7801\u7c7b\u4f3c\uff0c\u4e5f\u662f\u7528\u6807\u8bc6\u6765\u6807\u8bc6\u5185\u5bb9\u3002\u521b\u5efaXML\u6587\u6863\u5fc5\u987b\u9075\u5b88\u4e0b\u5217\u91cd\u8981\u89c4\u5219\uff1a<br \/>\n\u89c4\u52191\uff1a\u5fc5\u987b\u6709XML\u58f0\u660e\u8bed\u53e5<br \/>\n\u8fd9\u4e00\u70b9\u6211\u4eec\u5728\u4e0a\u4e00\u7ae0\u5b66\u4e60\u65f6\u5df2\u7ecf\u63d0\u5230\u8fc7\u3002\u58f0\u660e\u662fXML\u6587\u6863\u7684\u7b2c\u4e00\u53e5\uff0c\u5176\u683c\u5f0f\u5982\u4e0b\uff1a<br \/>\n&lt;?xml version=&#8221;1.0&#8243; standalone=&#8221;yes\/no&#8221; encoding=&#8221;UTF-8&#8243;?&gt;<br \/>\n\u58f0\u660e\u7684\u4f5c\u7528\u662f\u544a\u8bc9\u6d4f\u89c8\u5668\u6216\u8005\u5176\u5b83\u5904\u7406\u7a0b\u5e8f\uff1a\u8fd9\u4e2a\u6587\u6863\u662fXML\u6587\u6863\u3002\u58f0\u660e\u8bed\u53e5\u4e2d\u7684version\u8868\u793a\u6587\u6863\u9075\u5b88\u7684XML\u89c4\u8303\u7684\u7248\u672c\uff1bstandalone\u8868\u793a\u6587\u6863\u662f\u5426\u9644\u5e26DTD\u6587\u4ef6\uff0c\u5982\u679c\u6709\uff0c\u53c2\u6570\u4e3ano\uff1bencoding\u8868\u793a\u6587\u6863\u6240\u7528\u7684\u8bed\u8a00\u7f16\u7801\uff0c\u9ed8\u8ba4\u662fUTF-8\u3002<\/p>\n<p>\u89c4\u52192\uff1a\u662f\u5426\u6709DTD\u6587\u4ef6<br \/>\n\u5982\u679c\u6587\u6863\u662f\u4e00\u4e2a&#8221;\u6709\u6548\u7684XML\u6587\u6863&#8221;(\u89c1\u4e0a\u4e00\u7ae0)\uff0c\u90a3\u4e48\u6587\u6863\u4e00\u5b9a\u8981\u6709\u76f8\u5e94DTD\u6587\u4ef6\uff0c\u5e76\u4e14\u4e25\u683c\u9075\u5b88DTD\u6587\u4ef6\u5236\u5b9a\u7684\u89c4\u8303\u3002DTD\u6587\u4ef6\u7684\u58f0\u660e\u8bed\u53e5\u7d27\u8ddf\u5728XML\u58f0\u660e\u8bed\u53e5\u540e\u9762\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a<br \/>\n&lt;!DOCTYPE type-of-doc SYSTEM\/PUBLIC &#8220;dtd-name&#8221;&gt;<br \/>\n\u5176\u4e2d\uff1a<br \/>\n&#8220;!DOCTYPE&#8221;\u662f\u6307\u4f60\u8981\u5b9a\u4e49\u4e00\u4e2aDOCTYPE;<br \/>\n&#8220;type-of-doc&#8221;\u662f\u6587\u6863\u7c7b\u578b\u7684\u540d\u79f0\uff0c\u7531\u4f60\u81ea\u5df1\u5b9a\u4e49\uff0c\u901a\u5e38\u4e8eDTD\u6587\u4ef6\u540d\u76f8\u540c\uff1b<br \/>\n&#8220;SYSTEM\/PUBLIC&#8221;\u8fd9\u4e24\u4e2a\u53c2\u6570\u53ea\u7528\u5176\u4e00\u3002SYSTEM\u662f\u6307\u6587\u6863\u4f7f\u7528\u7684\u79c1\u6709DTD\u6587\u4ef6\u7684\u7f51\u5740\uff0c\u800cPUBLIC\u5219\u6307\u6587\u6863\u8c03\u7528\u4e00\u4e2a\u516c\u7528\u7684DTD\u6587\u4ef6\u7684\u7f51\u5740\u3002<br \/>\n&#8220;dtd-name&#8221; \u5c31\u662fDTD\u6587\u4ef6\u7684\u7f51\u5740\u548c\u540d\u79f0\u3002\u6240\u6709DTD\u6587\u4ef6\u7684\u540e\u7f00\u540d\u4e3a&#8221;.dtd&#8221;\u3002<br \/>\n\u6211\u4eec\u8fd8\u662f\u7528\u4e0a\u9762\u7684\u4f8b\u5b50\uff0c\u5e94\u8be5\u5199\u6210\u8fd9\u6837\uff1a<br \/>\n&lt;?xml version=&#8221;1.0&#8243; standalone=&#8221;no&#8221; encode=&#8221;UTF-8&#8243;?&gt;<br \/>\n&lt;!DOCTYPE filelist SYSTEM &#8220;filelist.dtd&#8221;&gt;<\/p>\n<p>\u89c4\u52193\uff1a\u6ce8\u610f\u4f60\u7684\u5927\u5c0f\u5199<br \/>\n\u5728XML\u6587\u6863\u4e2d\uff0c\u5927\u5c0f\u5199\u662f\u6709\u533a\u522b\u7684\u3002&lt;P&gt;\u548c&lt;p&gt;\u662f\u4e0d\u540c\u7684\u6807\u8bc6\u3002\u6ce8\u610f\u5728\u5199\u5143\u7d20\u65f6\uff0c\u524d\u540e\u6807\u8bc6\u5927\u5c0f\u5199\u8981\u4fdd\u6301\u4e00\u6837\u3002\u4f8b\u5982:&lt;Author&gt;ajie&lt;\/Author&gt;\uff0c\u5199\u6210&lt;Author&gt;ajie&lt;\/author&gt;\u662f\u9519\u8bef\u7684\u3002<br \/>\n\u4f60\u6700\u597d\u517b\u6210\u4e00\u79cd\u4e60\u60ef\uff0c\u6216\u8005\u5168\u90e8\u5927\u5199\uff0c\u6216\u8005\u5168\u90e8\u5c0f\u5199\uff0c\u6216\u8005\u5927\u5199\u7b2c\u4e00\u4e2a\u5b57\u6bcd\u3002\u8fd9\u6837\u53ef\u4ee5\u51cf\u5c11\u56e0\u4e3a\u5927\u5c0f\u5199\u4e0d\u5339\u914d\u4ea7\u751f\u7684\u6587\u6863\u9519\u8bef\u3002<\/p>\n<p>\u89c4\u52194\uff1a\u7ed9\u5c5e\u6027\u503c\u52a0\u5f15\u53f7<br \/>\n\u5728HTML\u4ee3\u7801\u91cc\u9762\uff0c\u5c5e\u6027\u503c\u53ef\u4ee5\u52a0\u5f15\u53f7\uff0c\u4e5f\u53ef\u4ee5\u4e0d\u52a0\u3002\u4f8b\u5982:&lt;font color=red&gt;word&lt;\/font&gt;\u548c&lt;font color=&#8221;red&#8221;&gt;word&lt;\/font&gt;\u90fd\u53ef\u4ee5\u88ab\u6d4f\u89c8\u5668\u6b63\u786e\u89e3\u91ca\u3002<br \/>\n\u4f46\u662f\u5728XML\u4e2d\u5219\u89c4\u5b9a\uff0c\u6240\u6709\u5c5e\u6027\u503c\u5fc5\u987b\u52a0\u5f15\u53f7(\u53ef\u4ee5\u662f\u5355\u5f15\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u53cc\u5f15\u53f7)\uff0c\u5426\u5219\u5c06\u88ab\u89c6\u4e3a\u9519\u8bef\u3002<\/p>\n<p>\u89c4\u52195\uff1a\u6240\u6709\u7684\u6807\u8bc6\u5fc5\u987b\u6709\u76f8\u5e94\u7684\u7ed3\u675f\u6807\u8bc6<br \/>\n\u5728HTML\u4e2d\uff0c\u6807\u8bc6\u53ef\u80fd\u4e0d\u662f\u6210\u5bf9\u51fa\u73b0\u7684\uff0c\u6bd4?lt;br&gt;\u3002\u800c\u5728XML\u4e2d\u89c4\u5b9a\uff0c\u6240\u6709\u6807\u8bc6\u5fc5\u987b\u6210\u5bf9\u51fa\u73b0\uff0c\u6709\u4e00\u4e2a\u5f00\u59cb\u6807\u8bc6\uff0c\u5c31\u5fc5\u987b\u6709\u4e00\u4e2a\u7ed3\u675f\u6807\u8bc6\u3002\u5426\u5219\u5c06\u88ab\u89c6\u4e3a\u9519\u8bef\u3002<\/p>\n<p>\u89c4\u52196\uff1a\u6240\u6709\u7684\u7a7a\u6807\u8bc6\u4e5f\u5fc5\u987b\u88ab\u5173\u95ed<br \/>\n\u7a7a\u6807\u8bc6\u5c31\u662f\u6807\u8bc6\u5bf9\u4e4b\u95f4\u6ca1\u6709\u5185\u5bb9\u7684\u6807\u8bc6\u3002\u6bd4\u5982&lt;br&gt;,&lt;img&gt;\u7b49\u6807\u8bc6\u3002\u5728XML\u4e2d\uff0c\u89c4\u5b9a\u6240\u6709\u7684\u6807\u8bc6\u5fc5\u987b\u6709\u7ed3\u675f\u6807\u8bc6\uff0c\u9488\u5bf9\u8fd9\u6837\u7684\u7a7a\u6807\u8bc6\uff0cXML\u4e2d\u5904\u7406\u7684\u65b9\u6cd5\u662f\u5728\u539f\u6807\u8bc6\u6700\u540e\u52a0\/\uff0c\u5c31\u53ef\u4ee5\u4e86\u3002\u4f8b\u5982\uff1a<br \/>\n&lt;br&gt;\u5e94\u5199\u4e3a&lt;br \/&gt;\uff1b<br \/>\n&lt;META name=&#8221;keywords&#8221; content=&#8221;XML, SGML, HTML&#8221;&gt;\u5e94\u5199\u4e3a&lt;META name=&#8221;keywords&#8221; content=&#8221;XML, SGML, HTML&#8221; \/&gt;\uff1b<br \/>\n&lt;IMG src= &#8220;cool.gif&#8221;&gt;\u5e94\u5199\u4e3a&lt;IMG src= &#8220;cool.gif&#8221; \/&gt;<br \/>\n\u4e8c.\u5143\u7d20\u7684\u8bed\u6cd5<\/p>\n<p>\u5143\u7d20\u7531\u4e00\u5bf9\u6807\u8bc6\u4ee5\u53ca\u5176\u4e2d\u7684\u5185\u5bb9\u7ec4\u6210\u3002\u5c31\u8c61\u8fd9\u6837\uff1aajie\u3002\u5143\u7d20\u7684\u540d\u79f0\u548c\u6807\u8bc6\u7684\u540d\u79f0\u662f\u4e00\u6837\u7684\u3002\u6807\u8bc6\u53ef\u4ee5\u7528\u5c5e\u6027\u6765\u8fdb\u4e00\u6b65\u63cf\u8ff0\u3002<\/p>\n<p>\u5728XML\u4e2d\uff0c\u6ca1\u6709\u4efb\u4f55\u4fdd\u7559\u5b57\uff0c\u6240\u4ee5\u4f60\u53ef\u4ee5\u968f\u5fc3\u6240\u6b32\u7684\u7528\u4efb\u4f55\u8bcd\u8bed\u6765\u4f5c\u4e3a\u5143\u7d20\u540d\u79f0\u3002\u4f46\u662f\u4e5f\u5fc5\u987b\u9075\u5b88\u4e0b\u5217\u89c4\u8303\uff1a<\/p>\n<p>1.\u540d\u79f0\u4e2d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u4ee5\u53ca\u5176\u5b83\u5b57\u6bcd\uff1b<\/p>\n<p>2.\u540d\u79f0\u4e0d\u80fd\u4ee5\u6570\u5b57\u6216&#8221;_&#8221; (\u4e0b\u5212\u7ebf)\u5f00\u5934\uff1b<\/p>\n<p>3.\u540d\u79f0\u4e0d\u80fd\u4ee5\u5b57\u6bcd xml(\u6216 XML \u6216 Xml ..)\u5f00\u5934<\/p>\n<p>4.\u540d\u79f0\u4e2d\u4e0d\u80fd\u5305\u542b\u7a7a\u683c<\/p>\n<p>5.\u540d\u79f0\u4e2d\u95f4\u4e0d\u80fd\u5305\u542b&#8221;:&#8221;(\u5192\u53f7)<\/p>\n<p>\u4e3a\u4e86\u4f7f\u5143\u7d20\u66f4\u5bb9\u6613\u9605\u8bfb\u7406\u89e3\u548c\u64cd\u4f5c\uff0c\u6211\u4eec\u8fd8\u6709\u4e00\u4e9b\u5efa\u8bae\uff1a<\/p>\n<p>1.\u540d\u79f0\u4e2d\u4e0d\u8981\u4f7f\u7528&#8221;.&#8221;\u3002\u56e0\u4e3a\u5728\u5f88\u591a\u7a0b\u5e8f\u8bed\u8a00\u4e2d,&#8221;.&#8221;\u662f\u4f5c\u4e3a\u5bf9\u8c61\u7684\u5c5e\u6027\uff0c\u4f8b\u5982\uff1afont.color\u3002\u540c\u6837\u7684\u539f\u56e0&#8221;-&#8220;\u4e5f\u6700\u597d\u4e0d\u8981\u7528\uff0c\u5fc5\u987b\u4f7f\u7528\u7684\uff0c\u4ee5&#8221;_&#8221;\u4ee3\u66ff\uff1b<\/p>\n<p>2.\u540d\u79f0\u5c3d\u91cf\u7b80\u77ed\u3002<\/p>\n<p>3.\u540d\u79f0\u7684\u5927\u5c0f\u5199\u5c3d\u91cf\u91c7\u7528\u540c\u4e00\u6807\u51c6\u3002<\/p>\n<p>4.\u540d\u79f0\u53ef\u4ee5\u4f7f\u7528\u975e\u82f1\u6587\u5b57\u7b26\uff0c\u6bd4\u5982\u7528\u4e2d\u6587\u3002\u4f46\u662f\u6709\u4e9b\u8f6f\u4ef6\u53ef\u80fd\u4e0d\u652f\u6301\u3002(IE5\u76ee\u524d\u662f\u652f\u6301\u4e2d\u6587\u5143\u7d20\u7684\u3002)<\/p>\n<p>\u53e6\u5916\uff0c\u8865\u5145\u4e00\u70b9\u5173\u4e8e\u5c5e\u6027\u7684\u8bf4\u660e\u3002\u5728HTML\u4e2d\uff0c\u5c5e\u6027\u53ef\u4ee5\u7528\u6765\u5b9a\u4e49\u5143\u7d20\u7684\u663e\u793a\u683c\u5f0f\uff0c\u6bd4\u5982\uff1a&lt;font color=&#8221;red&#8221;&gt;word&lt;\/font&gt;\u5c06\u628aword\u663e\u793a\u4e3a\u7ea2\u8272\u3002\u800c\u5728XML\u4e2d\uff0c\u5c5e\u6027\u53ea\u662f\u5bf9\u6807\u8bc6\u7684\u63cf\u8ff0\uff0c\u4e0e\u5143\u7d20\u5185\u5bb9\u7684\u663e\u793a\u65e0\u5173\u3002\u4f8b\u5982\u540c\u6837\u4e00\u53e5\uff1a&lt;font color=&#8221;red&#8221;&gt;word&lt;\/font&gt;\uff0c\u5e76\u4e0d\u4f1a\u5c06word\u663e\u793a\u4e3a\u7ea2\u8272\u3002(\u90a3\u4e48\uff0c\u6709\u7f51\u53cb\u4f1a\u95ee\uff1a\u5982\u4f55\u5728XML\u4e2d\u5c06\u6587\u5b57\u663e\u793a\u4e3a\u7ea2\u8272\u5462\uff1f\u8fd9\u5c31\u9700\u8981\u4f7f\u7528CSS\u6216\u8005XSL\uff0c\u6211\u4eec\u5728\u4e0b\u9762\u8be6\u7ec6\u8bb2\u8ff0\u3002)<\/p>\n<p>\u4e09.\u6ce8\u91ca\u7684\u8bed\u6cd5<\/p>\n<p>\u6ce8\u91ca\u662f\u4e3a\u4e86\u4fbf\u4e8e\u9605\u8bfb\u548c\u7406\u89e3\uff0c\u5728XML\u6587\u6863\u6dfb\u52a0\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5c06\u4e0d\u4f1a\u88ab\u7a0b\u5e8f\u89e3\u91ca\u6216\u5219\u6d4f\u89c8\u5668\u663e\u793a\u3002<\/p>\n<p>\u6ce8\u91ca\u7684\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<p>&lt;!&#8211; \u8fd9\u91cc\u662f\u6ce8\u91ca\u4fe1\u606f &#8211;&gt;<\/p>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u5b83\u548cHTML\u4e2d\u7684\u6ce8\u91ca\u8bed\u6cd5\u662f\u4e00\u6837\u7684\uff0c\u975e\u5e38\u5bb9\u6613\u3002\u517b\u6210\u826f\u597d\u7684\u6ce8\u91ca\u4e60\u60ef\u5c06\u4f7f\u4f60\u7684\u6587\u6863\u66f4\u52a0\u4fbf\u4e8e\u7ef4\u62a4\uff0c\u5171\u4eab\uff0c\u770b\u8d77\u6765\u4e5f\u66f4\u4e13\u4e1a\u3002<\/p>\n<p>\u56db.CDATA\u7684\u8bed\u6cd5<\/p>\n<p>CDATA\u5168\u79f0character data\uff0c\u7ffb\u8bd1\u4e3a\u5b57\u7b26\u6570\u636e\u3002\u6211\u4eec\u5728\u5199XML\u6587\u6863\u65f6\uff0c\u6709\u65f6\u9700\u8981\u663e\u793a\u5b57\u6bcd\uff0c\u6570\u5b57\u548c\u5176\u5b83\u7684\u7b26\u53f7\u672c\u8eab\uff0c\u6bd4\u5982&#8221;&lt;&#8220;\uff0c\u800c\u5728XML\u4e2d\uff0c\u8fd9\u4e9b\u5b57\u7b26\u5df2\u7ecf\u6709\u7279\u6b8a\u7684\u542b\u4e49\uff0c\u6211\u4eec\u600e\u4e48\u529e\u5462\uff1f\u8fd9\u5c31\u9700\u8981\u7528\u5230CDATA\u8bed\u6cd5\u3002\u8bed\u6cd5\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<p>&lt;![CDATA[\u8fd9\u91cc\u653e\u7f6e\u9700\u8981\u663e\u793a\u7684\u5b57\u7b26]]&gt;<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<p>&lt;![CDATA[&lt;AUTHOR sex=&#8221;female&#8221;&gt;ajie&lt;\/AUTHOR&gt;]]&gt;<\/p>\n<p>\u5728\u9875\u9762\u4e0a\u663e\u793a\u7684\u5185\u5bb9\u5c06\u662f&#8221;&lt;AUTHOR sex=&#8221;female&#8221;&gt;ajie&lt;\/AUTHOR&gt;&#8221;<\/p>\n<p>\u4e94.Namespaces\u7684\u8bed\u6cd5<\/p>\n<p>Namespaces\u7ffb\u8bd1\u4e3a\u540d\u5b57\u7a7a\u95f4\u3002\u540d\u5b57\u7a7a\u95f4\u6709\u4ec0\u4e48\u4f5c\u7528\u5462\uff1f\u5f53\u6211\u4eec\u5728\u4e00\u4e2aXML\u6587\u6863\u4e2d\u4f7f\u7528\u4ed6\u4eba\u7684\u6216\u8005\u591a\u4e2aDTD\u6587\u4ef6\uff0c\u5c31\u4f1a\u51fa\u73b0\u8fd9\u6837\u7684\u77db\u76fe\uff1a\u56e0\u4e3aXML\u4e2d\u6807\u8bc6\u90fd\u662f\u81ea\u5df1\u521b\u5efa\u7684\uff0c\u5728\u4e0d\u540c\u7684DTD\u6587\u4ef6\u4e2d\uff0c\u6807\u8bc6\u540d\u53ef\u80fd\u76f8\u540c\u4f46\u8868\u793a\u7684\u542b\u4e49\u4e0d\u540c\uff0c\u8fd9\u5c31\u53ef\u80fd\u5f15\u8d77\u6570\u636e\u6df7\u4e71\u3002<br \/>\n\u6bd4\u5982\u5728\u4e00\u4e2a\u6587\u6863&lt;table&gt;wood table&lt;\/table&gt;\u4e2d&lt;table&gt;\u8868\u793a\u684c\u5b50\uff0c<br \/>\n\u800c\u5728\u53e6\u4e00\u4e2a\u6587\u6863&lt;table&gt;namelist&lt;\/table&gt;\u4e2d&lt;table&gt;\u8868\u793a\u8868\u683c\u3002\u5982\u679c\u6211\u9700\u8981\u540c\u65f6\u5904\u7406\u8fd9\u4e24\u4e2a\u6587\u6863\uff0c\u5c31\u4f1a\u53d1\u751f\u540d\u5b57\u51b2\u7a81\u3002<br \/>\n\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u5f15\u8fdb\u4e86namespaces\u8fd9\u4e2a\u6982\u5ff5\u3002namespaces\u901a\u8fc7\u7ed9\u6807\u8bc6\u540d\u79f0\u52a0\u4e00\u4e2a\u7f51\u5740(URL)\u5b9a\u4f4d\u7684\u65b9\u6cd5\u6765\u533a\u522b\u8fd9\u4e9b\u540d\u79f0\u76f8\u540c\u7684\u6807\u8bc6\u3002<br \/>\nNamespaces\u540c\u6837\u9700\u8981\u5728XML\u6587\u6863\u7684\u5f00\u5934\u90e8\u5206\u58f0\u660e\uff0c\u58f0\u660e\u7684\u8bed\u6cd5\u5982\u4e0b\uff1a<br \/>\n&lt;document xmlns:yourname=&#8217;URL&#8217;&gt;<br \/>\n\u5176\u4e2dyourname\u662f\u7531\u4f60\u5b9a\u4e49\u7684namespaces\u7684\u540d\u79f0\uff0cURL\u5c31\u662f\u540d\u5b57\u7a7a\u95f4\u7684\u7f51\u5740\u3002<br \/>\n\u5047\u8bbe\u4e0a\u9762\u7684&#8221;\u684c\u5b50&lt;table&gt;&#8221;\u6587\u6863\u6765\u81ea<a href=\"http:\/\/www.zhuozi.com\/\">http:\/\/www.zhuozi.com<\/a>\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u58f0\u660e\u4e3a<br \/>\n&lt;document xmlns:zhuozi=&#8217;http:\/\/www.zhuozi.com&#8217;&gt;<br \/>\n\u7136\u540e\u5728\u540e\u9762\u7684\u6807\u8bc6\u4e2d\u4f7f\u7528\u5b9a\u4e49\u597d\u7684\u540d\u5b57\u7a7a\u95f4\uff1a<br \/>\n&lt;zhuozi:table&gt;wood table&lt;\/table&gt;<br \/>\n\u8fd9\u6837\u5c31\u5c06\u8fd9\u4e24\u4e2a&lt;table&gt;\u533a\u5206\u5f00\u6765\u3002\u6ce8\u610f\u7684\u662f\uff1a\u8bbe\u7f6eURL\u5e76\u4e0d\u662f\u8bf4\u8fd9\u4e2a\u6807\u8bc6\u771f\u7684\u8981\u5230\u90a3\u4e2a\u7f51\u5740\u53bb\u8bfb\u53d6\uff0c\u4ec5\u4ec5\u4f5c\u4e3a\u4e00\u79cd\u533a\u522b\u7684\u6807\u5fd7\u800c\u5df2\u3002<\/p>\n<p>\u516d.entity\u7684\u8bed\u6cd5<\/p>\n<p>entity\u7ffb\u8bd1\u4e3a&#8221;\u5b9e\u4f53&#8221;\u3002\u5b83\u7684\u4f5c\u7528\u7c7b\u4f3cword\u4e2d\u7684&#8221;\u5b8f&#8221;\uff0c\u4e5f\u53ef\u4ee5\u7406\u89e3\u4e3aDW\u4e2d\u7684\u6478\u677f\uff0c\u4f60\u53ef\u4ee5\u9884\u5148\u5b9a\u4e49\u4e00\u4e2aentity\uff0c\u7136\u540e\u5728\u4e00\u4e2a\u6587\u6863\u4e2d\u591a\u6b21\u8c03\u7528\uff0c\u6216\u8005\u5728\u591a\u4e2a\u6587\u6863\u4e2d\u8c03\u7528\u540c\u4e00\u4e2aentity\u3002<br \/>\nentity\u53ef\u4ee5\u5305\u542b\u5b57\u7b26\uff0c\u6587\u5b57\u7b49\u7b49\uff0c\u4f7f\u7528entity\u7684\u597d\u5904\u5728\u4e8e\uff1a1.\u5b83\u53ef\u4ee5\u51cf\u5c11\u5dee\u9519\uff0c\u6587\u6863\u4e2d\u591a\u4e2a\u76f8\u540c\u7684\u90e8\u5206\u53ea\u9700\u8981\u8f93\u5165\u4e00\u904d\u5c31\u53ef\u4ee5\u4e86\u30022.\u5b83\u63d0\u9ad8\u7ef4\u62a4\u6548\u7387\u3002\u6bd4\u5982\u4f60\u670940\u4e2a\u6587\u6863\u90fd\u5305\u542bcopyright\u7684entity\uff0c\u5982\u679c\u9700\u8981\u4fee\u6539\u8fd9\u4e2acopyright,\u4e0d\u9700\u8981\u6240\u6709\u7684\u6587\u4ef6\u90fd\u4fee\u6539\uff0c\u53ea\u8981\u6539\u6700\u521d\u5b9a\u4e49\u7684entity\u8bed\u53e5\u5c31\u53ef\u4ee5\u4e86\u3002<br \/>\nXML\u5b9a\u4e49\u4e86\u4e24\u79cd\u7c7b\u578b\u7684entity\u3002\u4e00\u79cd\u662f\u6211\u4eec\u8fd9\u91cc\u8bf4\u7684\u666e\u901aentity\uff0c\u5728XML\u6587\u6863\u4e2d\u4f7f\u7528\uff1b\u53e6\u4e00\u79cd\u662f\u53c2\u6570entity\uff0c\u5728DTD\u6587\u4ef6\u4e2d\u4f7f\u7528\u3002<br \/>\nentity\u7684\u5b9a\u4e49\u8bed\u6cd5\u4e3a:<br \/>\n&lt;!DOCTYPE filename [<br \/>\n&lt;!ENTITY entity-name &#8220;entity-content&#8221;<br \/>\n]<br \/>\n&gt;<br \/>\n\u4f8b\u5982\u6211\u8981\u5b9a\u4e49\u4e00\u6bb5\u7248\u6743\u4fe1\u606f:<br \/>\n&lt;!DOCTYPE copyright [<br \/>\n&lt;!ENTITY copyright &#8220;Copyright 2001, Ajie. All rights reserved&#8221;<br \/>\n]<br \/>\n&gt;<br \/>\n\u5982\u679c\u6211\u7684\u7248\u6743\u4fe1\u606f\u5185\u5bb9\u548c\u4ed6\u4eba\u5171\u4eab\u4e00\u4e2aXML\u6587\u4ef6\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u5916\u90e8\u8c03\u7528\u7684\u65b9\u6cd5\uff0c\u8bed\u6cd5\u8c61\u8fd9\u6837\uff1a<br \/>\n&lt;!DOCTYPE copyright [<br \/>\n&lt;!ENTITY copyright SYSTEM &#8220;<a href=\"http:\/\/www.sample.com\/copyright.xml\">http:\/\/www.sample.com\/copyright.xml<\/a>&#8220;&gt;<br \/>\n]<br \/>\n&gt;<br \/>\n\u5b9a\u4e49\u597d\u7684entity\u5728\u6587\u6863\u4e2d\u7684\u5f15\u7528\u8bed\u6cd5\u4e3a\uff1a&amp;entity-name;<br \/>\n\u4f8b\u5982\uff0c\u4e0a\u9762\u5b9a\u4e49\u7684\u7248\u6743\u4fe1\u606f\uff0c\u8c03\u7528\u65f6\u5199\u4f5c?copyright;<br \/>\n\u5b8c\u6574\u7684\u4f8b\u5b50\u5982\u4e0b\uff0c\u4f60\u53ef\u4ee5copy\u4e0b\u6765\u5b58\u4e3acopyright.xml\u89c2\u770b\u5b9e\u4f8b\uff1a<br \/>\n&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;GB2312&#8221;?&gt;<br \/>\n&lt;!DOCTYPE copyright [<br \/>\n&lt;!ENTITY copyright &#8220;Copyright 2001, Ajie. All rights reserved&#8221;&gt;<br \/>\n]&gt;<br \/>\n&lt;myfile&gt;<br \/>\n&lt;title&gt;XML&lt;\/title&gt;<br \/>\n&lt;author&gt;ajie&lt;\/author&gt;<br \/>\n&lt;email&gt;ajie@aolhoo.com&lt;\/email&gt;<br \/>\n&lt;date&gt;20010115&lt;\/date&gt;<br \/>\n\u00a9right;<br \/>\n&lt;\/myfile&gt;<\/p>\n<p>\u4e03.DTD\u7684\u8bed\u6cd5<\/p>\n<p>DTD\u662f&#8221;\u6709\u6548XML\u6587\u6863&#8221;\u7684\u5fc5\u987b\u6587\u4ef6\uff0c\u6211\u4eec\u901a\u8fc7DTD\u6587\u4ef6\u6765\u5b9a\u4e49\u6587\u6863\u4e2d\u5143\u7d20\u548c\u6807\u8bc6\u7684\u89c4\u5219\u53ca\u76f8\u4e92\u5173\u7cfb\u3002\u5982\u4f55\u5efa\u7acb\u4e00\u4e2aDTD\u6587\u4ef6\u5462\uff1f\u8ba9\u6211\u4eec\u4e00\u8d77\u6765\u5b66\u4e60\uff1a<\/p>\n<p>1.\u8bbe\u7f6e\u5143\u7d20<\/p>\n<p>\u5143\u7d20\u662fXML\u6587\u6863\u7684\u57fa\u672c\u7ec4\u6210\u90e8\u5206\u3002\u4f60\u8981\u5728DTD\u4e2d\u5b9a\u4e49\u4e00\u4e2a\u5143\u7d20\uff0c\u7136\u540e\u5728XML\u6587\u6863\u4e2d\u4f7f\u7528\u3002\u5143\u7d20\u7684\u5b9a\u4e49\u8bed\u6cd5\u4e3a\uff1a&lt;!ELEMENT DESCRIPTION (#PCDATA, DEFINITION)*&gt;<\/p>\n<p>\u8bf4\u660e\uff1a<\/p>\n<p>&#8220;&lt;!ELEMENT&#8221; \u662f\u5143\u7d20\u7684\u58f0\u660e\uff0c\u8bf4\u660e\u4f60\u8981\u5b9a\u4e49\u7684\u662f\u4e00\u4e2a\u5143\u7d20\uff1b<\/p>\n<p>\u58f0\u660e\u540e\u9762\u7684&#8221;DESCRIPTION&#8221;,\u662f\u5143\u7d20\u7684\u540d\u79f0\uff1b<\/p>\n<p>&#8220;(#PCDATA, DEFINITION)*&gt;&#8221;\u5219\u662f\u8be5\u5143\u7d20\u7684\u4f7f\u7528\u89c4\u5219\u3002\u89c4\u5219\u5b9a\u4e49\u4e86\u5143\u7d20\u53ef\u4ee5\u5305\u542b\u7684\u5185\u5bb9\u4ee5\u53ca\u76f8\u4e92\u7684\u5173\u7cfb\u3002\u4e0b\u9762\u7684\u8868\u683c\u6982\u8981\u5217\u51fa\u4e86\u5143\u7d20\u7684\u89c4\u5219\uff1a<\/p>\n<p>2.\u5143\u7d20\u89c4\u5219\u8868:<\/p>\n<p>Symbol<br \/>\n\u542b\u4e49<br \/>\n\u4e3e\u4f8b<\/p>\n<p>#PCDATA<\/p>\n<p>\u5305\u542b\u5b57\u7b26\u6216\u6587\u672c\u6570\u636e<br \/>\n&lt;MYFILE(#PCDATA)&gt;<br \/>\n\u5143\u7d20MYFILE\u5305\u542b\u4e00\u4e2a\u6587\u672c\u6570\u636e<\/p>\n<p>#PCDATA, element-name<br \/>\n\u5305\u542b\u6587\u672c\u548c\u5176\u5b83\u5b50\u5143\u7d20<br \/>\n&lt;MYFILE(#PCDTATA,TITLE)&gt;<br \/>\nMYFILE\u5143\u7d20\u5fc5\u987b\u5305\u542b\u6587\u672c\u548cTITLE\u5b50\u5143\u7d20<\/p>\n<p>,<\/p>\n<p>\u4f7f\u7528\u9017\u53f7\u5206\u9694\u6392\u5e8f<br \/>\n&lt;MYFILE (TITLE,AUTHOR,EMAIL)&gt;<br \/>\nMYFILE\u5143\u7d20\u5fc5\u987b\u4f9d\u6b21\u5305\u542bTITILE,AUTHOR,EMAIL\u4e09\u4e2a\u5b50\u5143\u7d20<\/p>\n<p>|<br \/>\n\u4f7f\u7528&#8221;|&#8221;\u8868\u793a\u6216\u8005<br \/>\n&lt;MYFILE (TITLE | AUTHOR | EMAIL)&gt;<br \/>\nMYFILE\u5143\u7d20\u5fc5\u987b\u5305\u542bTITLE\uff0c\u6216\u8005AUTHOR\u6216\u8005EMAIL\u5b50\u5143\u7d20\u3002<\/p>\n<p>name<br \/>\n\u53ea\u80fd\u4f7f\u7528\u4e00\u6b21<br \/>\n&lt;MYFILE (TITLE)&gt;<br \/>\nMYFILE\u5143\u7d20\u5fc5\u987b\u5305\u542bTITLE\u5b50\u5143\u7d20\uff0c\u800c\u4e14\u53ea\u80fd\u4f7f\u7528\u4e00\u6b21\u3002<\/p>\n<p>name?<\/p>\n<p>\u4f7f\u7528\u4e00\u6b21\u6216\u8005\u4e0d\u4f7f\u7528<br \/>\n&lt;MYFILE (TITLE,AUTHOR?,EMAIL?)&gt;<br \/>\nMYFILE\u5143\u7d20\u5fc5\u987b\u5305\u542bTITLE\u5b50\u5143\u7d20\uff0c\u800c\u4e14\u53ea\u80fd\u4f7f\u7528\u4e00\u6b21\uff1b\u53ef\u4ee5\u5305\u542b\u6216\u8005\u4e0d\u5305\u542bAUTHOR\u548cEMAIL\u5b50\u5143\u7d20\uff0c\u4f46\u662f\u5982\u679c\u4f7f\u7528\uff0c\u53ea\u80fd\u4e00\u6b21\u3002<\/p>\n<p>name+<\/p>\n<p>\u4f7f\u7528\u81f3\u5c11\u4e00\u6b21\u6216\u591a\u6b21<br \/>\n&lt;MYFILE (TITLE+,AUTHOR?,EMAIL)&gt;<br \/>\nMYFILE\u5143\u7d20\u5fc5\u987b\u5305\u542bTITLE\u5b50\u5143\u7d20\uff0c\u800c\u4e14\u4f7f\u7528\u81f3\u5c11\u4e00\u6b21\uff1b\u63a5\u4e0b\u6765\u53ef\u4ee5\u8ddf\u968fAUTHOR\u5b50\u5143\u7d20\uff0c\u4e5f\u53ef\u4ee5\u4e0d\u8ddf\uff1b\u6700\u540e\u5fc5\u987b\u5305\u542bEMAIL\u5b50\u5143\u7d20\uff0c\u800c\u4e14\u53ea\u80fd\u4f7f\u7528\u4e00\u6b21\u3002<\/p>\n<p>name*<\/p>\n<p>\u4f7f\u7528\u4e00\u6b21\uff0c\u591a\u6b21\uff0c\u6216\u8005\u6839\u672c\u4e0d\u4f7f\u7528<br \/>\n&lt;MYFILE (TITLE*)&gt;<br \/>\nMYFILE\u5143\u7d20\u53ef\u4ee5\u5305\u542b\u4e00\u4e2a\uff0c\u591a\u4e2a\u6216\u8005\u4e0d\u5305\u542bTITLE\u5b50\u5143\u7d20<\/p>\n<p>( )<\/p>\n<p>\u8bbe\u7f6e\u7ec4\uff0c\u53ef\u4ee5\u5d4c\u5957<br \/>\n&lt;MYFILE(#PCDATA | TITLE)*&gt;<br \/>\n\u5143\u7d20MYFILE\u5305\u542b\u4e00\u4e2a\u6216\u8005\u66f4\u591a\u7684\u6587\u672c\u6216\u8005TITLE\u5b50\u5143\u7d20\u3002<br \/>\n&lt;MYFILE((TITLE*, AUTHOR?, EMAIL)* | COMMENT)&gt;<br \/>\nMYFILE\u5143\u7d20\u5fc5\u987b\u5305\u542b\u4e00\u4e9b\u5185\u5bb9\uff0c\u5185\u5bb9\u6216\u8005\u662f\u4e00\u4e2a\u6ce8\u91ca\uff1b\u4e5f\u6216\u8005\u662f\u591a\u4e2a\u7ec4\uff0c\u7ec4\u91cc\u5305\u542b\uff1a\u4e00\u4e2a\uff0c\u591a\u4e2a\u6216\u8005\u6ca1\u6709TITLE\u5b50\u5143\u7d20\uff0c\u63a5\u7740\u662f\u4e00\u4e2a\u6216\u8005\u6ca1\u6709AUTHOR\u5b50\u5143\u7d20\uff0c\u518d\u63a5\u7740\u662f\u4e00\u4e2a\u5fc5\u987b\u7684EMAIL\u5b50\u5143\u7d20\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u4e3a\u5143\u7d20\u5b9a\u4e49\u5c5e\u6027\uff0c\u56e0\u4e3a\u6211\u4eec\u4e0d\u63a8\u8350\u4f7f\u7528\u5c5e\u6027\uff0c\u5728\u8fd9\u91cc\u5c31\u4e0d\u8be6\u7ec6\u5c55\u5f00\u4e86\u3002<\/p>\n<p>\u6700\u540e\uff0c\u6211\u4eec\u6765\u603b\u7ed3\u4e00\u4e9b\u524d\u56db\u7ae0\u5b66\u4e60\u7684\u5185\u5bb9\uff0c\u5199\u4e00\u4e2a\u5305\u542bDTD\uff0cXML\uff0c\u4ee5\u53caScript\u7684\u7b80\u5355\u5b9e\u4f8b\uff0c\u4fbf\u4e8e\u8bfb\u8005\u7406\u89e3\uff1a<br \/>\n1.\u5c06\u4e0b\u9762\u6587\u4ef6\u5b58\u4e3amyfile.dtd<br \/>\n&lt;!ELEMENT myfile (title, author)&gt;<br \/>\n&lt;!ELEMENT title (#PCDATA)&gt;<br \/>\n&lt;!ELEMENT author (#PCDATA)&gt;<\/p>\n<p>2.\u7136\u540e\u5efa\u7acbXML\u6587\u6863myfile.xml:<br \/>\n&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;GB2312&#8221;?&gt;<br \/>\n&lt;!DOCTYPE myfile SYSTEM &#8220;myfile.dtd&#8221;&gt;<br \/>\n&lt;myfile&gt;<br \/>\n&lt;title&gt;XML\u8f7b\u677e\u5b66\u4e60\u624b\u518c&lt;\/title&gt;<br \/>\n&lt;author&gt;ajie&lt;\/author&gt;<br \/>\n&lt;\/myfile&gt;<\/p>\n<p>3.\u5efa\u7acbHTML\u6587\u6863myfile.html<br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;script language=&#8221;JavaScript&#8221; for=&#8221;window&#8221; event=&#8221;onload&#8221;&gt;<br \/>\nvar xmlDoc = new ActiveXObject(&#8220;Microsoft.XMLDOM&#8221;);<br \/>\nxmlDoc.async=&#8221;false&#8221;;<br \/>\nxmlDoc.load(&#8220;myfile.xml&#8221;);<br \/>\nnodes = xmlDoc.documentElement.childNodes;<br \/>\ntitle.innerText = nodes.item(0).text;<br \/>\nauthor.innerText = nodes.item(1).text;<br \/>\n&lt;\/script&gt;<br \/>\n&lt;title&gt;\u5728HTML\u4e2d\u8c03\u7528XML\u6570\u636e&lt;\/title&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body bgcolor=&#8221;#FFFFFF&#8221;&gt;<br \/>\n&lt;b&gt;\u6807\u9898: &lt;\/b&gt;<br \/>\n&lt;span id=&#8221;title&#8221;&gt;&lt;\/span&gt;&lt;br&gt;<br \/>\n&lt;b&gt;\u4f5c\u8005: &lt;\/b&gt;<br \/>\n&lt;span id=&#8221;author&#8221;&gt;&lt;\/span&gt;&lt;br&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<p>4.\u7528IE5.0\u4ee5\u4e0a\u6d4f\u89c8\u5668\u6253\u5f00myfile.html\u5c31\u53ef\u4ee5\u770b\u5230\u6548\u679c\u4e86\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00.XML\u8bed\u6cd5\u89c4\u5219 XML\u7684\u6587\u6863\u548cHTML\u7684\u539f\u4ee3\u7801\u7c7b\u4f3c\uff0c\u4e5f\u662f\u7528\u6807\u8bc6\u6765\u6807\u8bc6\u5185\u5bb9\u3002\u521b\u5efaXML\u6587\u6863\u5fc5\u987b\u9075\u5b88\u4e0b\u5217\u91cd\u8981\u89c4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-176","post","type-post","status-publish","format-standard","hentry","category-code_related"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=176"}],"version-history":[{"count":1,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/176\/revisions"}],"predecessor-version":[{"id":5202,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/176\/revisions\/5202"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}