{"id":231068,"date":"2021-12-04T09:15:11","date_gmt":"2021-12-04T01:15:11","guid":{"rendered":"https:\/\/gulass.cn\/?p=231068"},"modified":"2021-11-28T17:16:09","modified_gmt":"2021-11-28T09:16:09","slug":"xml-server-overview","status":"publish","type":"post","link":"https:\/\/gulass.cn\/xml-server-overview.html","title":{"rendered":"XML\u670d\u52a1\u5668\u6982\u8ff0"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nXML \u6587\u4ef6\u662f\u7c7b\u4f3c HTML \u6587\u4ef6\u7684\u7eaf\u6587\u672c\u6587\u4ef6\u3002XML \u80fd\u591f\u901a\u8fc7\u6807\u51c6\u7684 Web \u670d\u52a1\u5668\u8f7b\u677e\u5730\u5b58\u50a8\u548c\u751f\u6210\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u5728\u670d\u52a1\u5668\u4e0a\u5b58\u50a8 XML \u6587\u4ef6<\/strong><\/div>\n

XML \u6587\u4ef6\u5728 Internet \u670d\u52a1\u5668\u4e0a\u8fdb\u884c\u5b58\u50a8\u7684\u65b9\u5f0f\u4e0e HTML \u6587\u4ef6\u5b8c\u5168\u76f8\u540c\u3002<\/p>\n

\u542f\u52a8 Windows \u8bb0\u4e8b\u672c\uff0c\u5e76\u5199\u5165\u4ee5\u4e0b\u884c\uff1a<\/p>\n

\r\n<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<note>\r\n<from>Jani<\/from>   \r\n<to>Tove<\/to>\r\n<message>Remember me this weekend<\/message>\r\n<\/note>\r\n<\/pre>\n

\u7136\u540e\u7528\u9002\u5f53\u7684\u6587\u4ef6\u540d\uff0c\u6bd4\u5982 \"note.xml\"\uff0c\u5728 Web \u670d\u52a1\u5668\u4e0a\u4fdd\u5b58\u8fd9\u4e2a\u6587\u4ef6\u3002<\/p>\n

\u901a\u8fc7 ASP \u751f\u6210 XML<\/strong><\/div>\n

XML \u53ef\u5728\u4e0d\u5b89\u88c5\u4efb\u4f55 XML \u8f6f\u4ef6\u7684\u60c5\u51b5\u4e0b\u5728\u670d\u52a1\u5668\u7aef\u751f\u6210\u3002<\/p>\n

\u5982\u9700\u4ece\u670d\u52a1\u5668\u751f\u6210 XML \u54cd\u5e94 - \u53ea\u9700\u7b80\u5355\u5730\u7f16\u5199\u4ee5\u4e0b\u4ee3\u7801\u5e76\u5728 Web \u670d\u52a1\u5668\u4e0a\u628a\u5b83\u4fdd\u5b58\u4e3a\u4e00\u4e2a ASP \u6587\u4ef6\uff1a<\/p>\n

\r\n<%\r\nresponse.ContentType=\"text\/xml\"\r\nresponse.Write(\"<?xml version='1.0' encoding='ISO-8859-1'?>\")\r\nresponse.Write(\"<note>\")\r\nresponse.Write(\"<from>Jani<\/from>\")\r\nresponse.Write(\"<to>Tove<\/to>\")\r\nresponse.Write(\"<message>Remember me this weekend<\/message>\")\r\nresponse.Write(\"<\/note>\")\r\n%>\r\n<\/pre>\n

\u8bf7\u6ce8\u610f\uff0c\u6b64\u54cd\u5e94\u7684\u5185\u5bb9\u7c7b\u578b\u5fc5\u987b\u8bbe\u7f6e\u4e3a \"text\/xml\"\u3002<\/p>\n

\u901a\u8fc7 PHP \u751f\u6210 XML<\/strong><\/div>\n

\u5982\u9700\u4f7f\u7528 PHP \u4ece\u670d\u52a1\u5668\u4e0a\u751f\u6210 XML \u54cd\u5e94\uff0c\u8bf7\u4f7f\u7528\u4e0b\u9762\u7684\u4ee3\u7801\uff1a<\/p>\n

\r\n<?php\r\nheader(\"Content-type: text\/xml\");\r\necho \"<?xml version='1.0' encoding='ISO-8859-1'?>\";\r\necho \"<note>\";\r\necho \"<from>Jani<\/from>\";\r\necho \"<to>Tove<\/to>\";\r\necho \"<message>Remember me this weekend<\/message>\";\r\necho \"<\/note>\";\r\n?>\r\n<\/pre>\n

\u8bf7\u6ce8\u610f\uff0c\u54cd\u5e94\u5934\u90e8\u7684\u5185\u5bb9\u7c7b\u578b\u5fc5\u987b\u8bbe\u7f6e\u4e3a \"text\/xml\"\u3002<\/p>\n

\u4ece\u6570\u636e\u5e93\u751f\u6210 XML<\/strong><\/div>\n

XML \u53ef\u5728\u4e0d\u5b89\u88c5\u4efb\u4f55 XML \u8f6f\u4ef6\u7684\u60c5\u51b5\u4e0b\u4ece\u6570\u636e\u5e93\u751f\u6210\u3002<\/p>\n

\u5982\u9700\u4ece\u670d\u52a1\u5668\u751f\u6210 XML \u6570\u636e\u5e93\u54cd\u5e94\uff0c\u53ea\u9700\u7b80\u5355\u5730\u7f16\u5199\u4ee5\u4e0b\u4ee3\u7801\uff0c\u5e76\u628a\u5b83\u5728 Web \u670d\u52a1\u5668\u4e0a\u4fdd\u5b58\u4e3a ASP \u6587\u4ef6\uff1a<\/p>\n

\r\n<%\r\nresponse.ContentType = \"text\/xml\"\r\nset conn=Server.CreateObject(\"ADODB.Connection\")\r\nconn.provider=\"Microsoft.Jet.OLEDB.4.0;\"\r\nconn.open server.mappath(\"\/db\/database.mdb\")\r\nsql=\"select fname,lname from tblGuestBook\"\r\nset rs=Conn.Execute(sql)\r\nresponse.write(\"<?xml version='1.0' encoding='ISO-8859-1'?>\")\r\nresponse.write(\"<guestbook>\")\r\nwhile (not rs.EOF)\r\n  response.write(\"<guest>\")\r\n  response.write(\"<fname>\" & rs(\"fname\") & \"<\/fname>\")\r\n  response.write(\"<lname>\" & rs(\"lname\") & \"<\/lname>\")\r\n  response.write(\"<\/guest>\")\r\n  rs.MoveNext()\r\nwend\r\nrs.close()\r\nconn.close()\r\nresponse.write(\"<\/guestbook>\")\r\n%>\r\n<\/pre>\n

\u4e0a\u9762\u7684\u5b9e\u4f8b\u4f7f\u7528\u4e86\u5e26\u6709 ADO \u7684 ASP\u3002<\/p>\n

\u5728\u670d\u52a1\u5668\u4e0a\u901a\u8fc7 XSLT \u8f6c\u6362 XML<\/strong><\/div>\n

\u4e0b\u9762\u7684 ASP \u4ee3\u7801\u5728\u670d\u52a1\u5668\u4e0a\u628a XML \u6587\u4ef6\u8f6c\u6362\u4e3a XHTML\uff1a<\/p>\n

\r\n<%\r\n'Load XML\r\nset xml = Server.CreateObject(\"Microsoft.XMLDOM\")\r\nxml.async = false\r\nxml.load(Server.MapPath(\"simple.xml\"))\r\n'Load XSL\r\nset xsl = Server.CreateObject(\"Microsoft.XMLDOM\")\r\nxsl.async = false\r\nxsl.load(Server.MapPath(\"simple.xsl\"))\r\n'Transform file\r\nResponse.Write(xml.transformNode(xsl))\r\n%>\r\n<\/pre>\n

\u5b9e\u4f8b\u89e3\u91ca<\/p>\n

    \n
  1. \u7b2c\u4e00\u4e2a\u4ee3\u7801\u5757\u521b\u5efa\u5fae\u8f6f XML \u89e3\u6790\u5668\u7684\u5b9e\u4f8b\uff08XMLDOM\uff09\uff0c\u5e76\u628a XML \u6587\u4ef6\u8f7d\u5165\u5185\u5b58\u3002<\/li>\n
  2. \u7b2c\u4e8c\u4e2a\u4ee3\u7801\u5757\u521b\u5efa\u89e3\u6790\u5668\u7684\u53e6\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u5e76\u628a XSL \u6587\u4ef6\u8f7d\u5165\u5185\u5b58\u3002<\/li>\n
  3. \u6700\u540e\u4e00\u4e2a\u4ee3\u7801\u4f7f\u7528 XSL \u6587\u6863\u6765\u8f6c\u6362 XML \u6587\u6863\uff0c\u5e76\u628a\u7ed3\u679c\u4ee5 XHTML \u53d1\u9001\u5230\u60a8\u7684\u6d4f\u89c8\u5668\u3002<\/li>\n<\/ol>\n
    \u901a\u8fc7 ASP \u628a XML \u4fdd\u5b58\u4e3a\u6587\u4ef6<\/strong><\/div>\n

    \u8fd9\u4e2a ASP \u5b9e\u4f8b\u4f1a\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684 XML \u6587\u6863\uff0c\u5e76\u628a\u8be5\u6587\u6863\u4fdd\u5b58\u5230\u670d\u52a1\u5668\u4e0a\uff1a<\/p>\n

    \r\n<%\r\ntext=\"<note>\"\r\ntext=text & \"<to>Tove<\/to>\"\r\ntext=text & \"<from>Jani<\/from>\"\r\ntext=text & \"<heading>Reminder<\/heading>\"\r\ntext=text & \"<body>Don't forget me this weekend!<\/body>\"\r\ntext=text & \"<\/note>\"\r\nset xmlDoc=Server.CreateObject(\"Microsoft.XMLDOM\")\r\nxmlDoc.async=false\r\nxmlDoc.loadXML(text)\r\nxmlDoc.Save(\"test.xml\")\r\n%>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

    XML \u6587\u4ef6\u5728 Internet \u670d\u52a1\u5668\u4e0a\u8fdb\u884c\u5b58\u50a8\u7684\u65b9\u5f0f\u4e0e HTML \u6587\u4ef6\u5b8c\u5168\u76f8\u540c\u3002 \u542f\u52a8 Windows \u8bb0 […]<\/p>\n","protected":false},"author":1481,"featured_media":231046,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-231068","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/231068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/1481"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=231068"}],"version-history":[{"count":3,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/231068\/revisions"}],"predecessor-version":[{"id":231071,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/231068\/revisions\/231071"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/231046"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=231068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=231068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=231068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}