{"id":256,"date":"2006-01-20T17:01:04","date_gmt":"2006-01-20T09:01:04","guid":{"rendered":"http:\/\/fdream.net\/blog\/article\/256.aspx"},"modified":"2006-03-26T18:03:04","modified_gmt":"2006-03-26T10:03:04","slug":"ASP%e5%a4%84%e7%90%86XML%e6%96%87%e6%a1%a3","status":"publish","type":"post","link":"https:\/\/fdream.net\/blog\/article\/256","title":{"rendered":"ASP\u5904\u7406XML\u6587\u6863"},"content":{"rendered":"<p>\u8fd9\u4e2a\u5b66\u671f\u524d\u671f\u5199\u7684\u4e00\u6bb5\u4ee3\u7801\uff0c\u672c\u6765\u662f\u60f3\u81ea\u5df1\u505a\u4e00\u4e2aXNA\uff08XML\u805a\u5408\uff09\u7684\uff0c\u7531\u4e8e\u79cd\u79cd\u539f\u56e0\uff0c\u505a\u4e86\u4e00\u90e8\u5206\u5c31\u7ec8\u6b62\u4e86\uff0c\u8fd9\u662f\u5176\u4e2d\u5904\u7406XML\u6587\u6863\u7684\u4e00\u90e8\u5206\u3002<\/p>\n<blockquote>\n<p>&#8216;xml\u52a0\u8f7d\uff0c\u5176\u4e2d linkurl \u4e3a\u8868\u793a XML \u6587\u6863\u7684 URL \u7684\u53d8\u91cf<br \/>Set http=Server.CreateObject(&#8220;Microsoft.XMLHTTP&#8221;) <br \/>http.Open &#8220;GET&#8221;,linkurl,False <br \/>http.send <\/p>\n<p>Set xmlDoc=Server.CreateObject(&#8220;Microsoft.XMLDOM&#8221;) <br \/>xmlDoc.Async=False <br \/>xmlDoc.ValidateOnParse=False <br \/>xmlDoc.Load(http.ResponseXML)<\/p>\n<p>&#8216;xml\u7ed3\u70b9\u8bbe\u7f6e<\/p>\n<p>set root = xmlDoc.documentElement<\/p>\n<p>&#8216;\u6839\u636e\u7ed3\u70b9\u9009\u53d6\u6570\u636e\uff0c\u517c\u5bb9XML 1.0\u89c4\u8303\u548c XML 2.0\u89c4\u8303<br \/>set nodeLis = root.getElementsByTagName(&#8220;item&#8221;)<\/p>\n<p>&#8216;\u5bf9\u4e8eXML\u6587\u4ef6\u4e2d\u65f6\u95f4\u6807\u7b7e\u4e0d\u540c\u7684\u517c\u5bb9\u5904\u7406<br \/>nodeCount = nodeLis.length<br \/>dim t,itemnode,nodeFlag,x,nodeString,nodelist<br \/>nodeFlag=0<br \/>set nodelist = root.getElementsByTagName(&#8220;item&#8221;)<br \/>nodeString=&#8221;pubDate&#8221;<br \/>set itemnode = nodelist.nextNode()<br \/>t=itemnode.childnodes.length<br \/>for x=0 to t-1<br \/>\tif(StrComp(itemnode.childNodes(x).nodeName,nodeString)=0) then<br \/>\t\tnodeFlag=1<br \/>\t\texit for<br \/>\tend if<br \/>next<\/p>\n<p>For i=1 to nodeCount <br \/>set node = nodeLis.nextNode()<\/p>\n<p>&#8216;\u5904\u7406xml<br \/>dim pubDate,pubTime,pub,dateString,link,title,describ,today<br \/>dim dateArray<br \/>today=Date()<br \/>dateArray=Array(&#8220;Jan&#8221;,&#8221;Feb&#8221;,&#8221;Mar&#8221;,&#8221;Apr&#8221;,&#8221;May&#8221;,&#8221;June&#8221;,&#8221;July&#8221;,&#8221;Aug&#8221;,&#8221;Sep&#8221;,&#8221;Oct&#8221;,&#8221;Nov&#8221;,&#8221;Dec&#8221;)<br \/>title=node.sel&#101;ctSingleNode(&#8220;title&#8221;).text<br \/>link=node.sel&#101;ctSingleNode(&#8220;link&#8221;).text<br \/>describ=node.sel&#101;ctSingleNode(&#8220;description&#8221;).text<\/p>\n<p>&#8216;\u65f6\u95f4\u6807\u7b7e\u4e3a pubDate<br \/>if nodeFlag=1 then<br \/>\tdateString=node.sel&#101;ctSingleNode(&#8220;pubDate&#8221;).text<br \/>&#8216;\u65f6\u95f4\u6807\u7b7e\u4e3a dc:date<br \/>else<br \/>\tdateString=node.sel&#101;ctSingleNode(&#8220;dc:date&#8221;).text<br \/>end if<\/p>\n<p>&#8216;\u5bf9\u4e8e\u65f6\u95f4\u683c\u5f0f\u4e0d\u7edf\u4e00\u8fdb\u884c\u683c\u5f0f\u5316<br \/>dateString=dateString+&#8221; &#8220;<br \/>pub=split(dateString,&#8221; &#8220;)<br \/>if(ubound(pub)<=2) then<br \/>\tpubDate=pub(0)<br \/>\tpubTime=pub(1)<br \/>else<br \/>\tfor j=0 to 11<br \/>\t\tif(StrComp(pub(2),dateArray(j))=0) then<br \/>\t\t\tpub(2)=j+1<br \/>\t\t\texit for<br \/>\t\tend if<br \/>\tNext<br \/>\tpubDate=pub(3)&#038;&#8221;-&#8220;&#038;pub(2)&#038;&#8221;-&#8220;&#038;pub(1)<br \/>\tpubTime=pub(4)<br \/>end if<\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u4e2a\u5b66\u671f\u524d\u671f\u5199\u7684\u4e00\u6bb5\u4ee3\u7801\uff0c\u672c\u6765\u662f\u60f3\u81ea\u5df1\u505a\u4e00\u4e2aXNA\uff08XML\u805a\u5408\uff09\u7684\uff0c\u7531\u4e8e\u79cd\u79cd\u539f\u56e0\uff0c\u505a\u4e86\u4e00\u90e8\u5206\u5c31\u7ec8\u6b62\u4e86\uff0c\u8fd9\u662f\u5176\u4e2d\u5904\u7406XML\u6587\u6863\u7684\u4e00\u90e8\u5206\u3002 &#8216;xml\u52a0\u8f7d\uff0c\u5176\u4e2d linkurl \u4e3a\u8868\u793a XML \u6587\u6863\u7684 URL \u7684\u53d8\u91cfSet http=Server.CreateObject(&#8220;Microsoft.XMLHTTP&#8221;) http.Open &#8220;GET&#8221;,linkurl,False http.send Set xmlDoc=Server.CreateObject(&#8220;Microsoft.XMLDOM&#8221;) xmlDoc.Async=False xmlDoc.ValidateOnParse=False xmlDoc.Load(http.ResponseXML) &#8216;xml\u7ed3\u70b9\u8bbe\u7f6e set root = xmlDoc.documentElement &#8216;\u6839\u636e\u7ed3\u70b9\u9009\u53d6\u6570\u636e\uff0c\u517c\u5bb9XML 1.0\u89c4\u8303\u548c XML 2.0\u89c4\u8303set nodeLis = root.getElementsByTagName(&#8220;item&#8221;) &#8216;\u5bf9\u4e8eXML\u6587\u4ef6\u4e2d\u65f6\u95f4\u6807\u7b7e\u4e0d\u540c\u7684\u517c\u5bb9\u5904\u7406nodeCount = nodeLis.lengthdim t,itemnode,nodeFlag,x,nodeString,nodelistnodeFlag=0set nodelist = root.getElementsByTagName(&#8220;item&#8221;)nodeString=&#8221;pubDate&#8221;set itemnode = nodelist.nextNode()t=itemnode.childnodes.lengthfor x=0 to t-1 if(StrComp(itemnode.childNodes(x).nodeName,nodeString)=0) then nodeFlag=1 exit for end ifnext For i=1 to nodeCount set node &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[25,356,357,26],"class_list":["post-256","post","type-post","status-publish","format-standard","hentry","category-coding","tag-ASP","tag-rss","tag-xml","tag-26"],"views":24737,"_links":{"self":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/comments?post=256"}],"version-history":[{"count":0,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/256\/revisions"}],"wp:attachment":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/media?parent=256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/categories?post=256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/tags?post=256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}