atom_js.asp
atom_js.asp
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:

复制代码 代码如下:

<%

'Iconvertedsomeofyourexamplefoundonhttp://www.iteam5.net/francesco/atom/overtojscript.

'Feelfreetouseitandkeepupthegoodwork.

'TysonKopczynski

'tyson@cco.com

functionatom(strURL)

{

varobjXML=newActiveXObject("msxml2.DOMDocument.3.0");

objXML.async=false;

objXML.setProperty("ServerHTTPRequest",true);

objXML.validateOnParse=true;

objXML.preserveWhiteSpace=false;

if(!objXML.load(strURL))

{

vararray=newArray();

Response.Write("<P>ERROR<br>code:"+objXML.parseError.errorCode)

Response.Write("<br>Linea/Col:"+objXML.parseError.line&"/"+objXML.parseError.linepos)

Response.Write("</P>")

return(array)

}

else

{

varobjNodeList=objXML.getElementsByTagName("entry");

vararrDicts=newArray(objNodeList.length);

for(vari=0;i<objNodeList.length;i++)

{

arrDicts[i]=newActiveXObject("Scripting.Dictionary");

arrDicts[i].Item("issued")=objNodeList[i].getElementsByTagName("issued")[0].firstChild.nodeValue

arrDicts[i].Item("id")=objNodeList[i].getElementsByTagName("id")[0].firstChild.nodeValue

arrDicts[i].Item("link")=objNodeList[i].getElementsByTagName("link")[1].getAttribute("href")

arrDicts[i].Item("author")=objNodeList[i].getElementsByTagName("author")[0].xml

arrDicts[i].Item("title")=objNodeList[i].getElementsByTagName("title")[0].firstChild.nodeValue

arrDicts[i].Item("content")=objNodeList[i].getElementsByTagName("content")[0].xml

}

return(arrDicts)

}

}

varblogURL="http://taosage-net.blogspot.com/atom.xml";

varblogItems=atom(blogURL);

Response.Write("<strong>")

Response.Write("<ahref='"+blogItems[0].Item("link")+"'>"+blogItems[0].Item("title")+"</a>")

Response.Write("</strong>")

Response.Write("<tablewidth='100%'cellspacing='0'cellpadding='0'>")

Response.Write("<tr>")

Response.Write("<tdwidth='10'rowspan='2'></td>")

Response.Write("<td>"+blogItems[0].Item("content")+"<br></td>")

Response.Write("</tr>")

Response.Write("<tr>")

Response.Write("<td>postedby"+blogItems[0].Item("author")+"@"+blogItems[0].Item("issued")+"</td>")

Response.Write("</tr>")

Response.Write("</table>")

%>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新ASP教程学习
热门ASP教程学习
编程开发子分类