atom_js.asp

2018-09-06 13:18

阅读:566

  复制代码 代码如下:
<%
Iconvertedsomeofyourexamplefoundon
Feelfreetouseitandkeepupthegoodwork.
TysonKopczynski


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=
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=0cellpadding=0>)
Response.Write(<tr>)
Response.Write(<tdwidth=10rowspan=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>)
%>



评论


亲,登录后才可以留言!