Sat, 20 May 2006. 找找吧
吧台 读吧 链接 留言 设计沙龙 BT Men
找找吧
 
Photoshop . Flash . Asp . Dreamweaver . Css . Html . JavaScript . Xml . Flash AS . WEB标准 . Illustrator . Sql . WEB配色 . Access . ASP.NET 2.0 . VBScript . Xslt . Rss . Swift3D . IIS . Wap . WEB2.0 . .Net . Flsh AS .
‹ 试从动态的角度思考标识设计 编程开发 编程开发 设计进入生活 ›
ASP远程读取RSS列表源码
马马虎虎 water 整理于 :13 来自: 白菜世纪 晴天 作者:    Large Medium Small
原始资料:

最近公司要用ASP做一个项目,远程读取“DONEWS”网站的RSS,地址为:
http://www.donews.com/rss.xml
要求:
1。ASP远程读取XML文件
2。在网页上显示出该XML文件的部分内容,如:只显示<title><link>的内容
3。只显示最新的10条新闻

白菜修改版:




<% @language="VBScript"%>
<html>
<head>
<title>远程读取XML文件</title>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<style type="text/css">
p {font-size:12px;}
p.font {font-size:14px;}
p.indent {text-indent:24px;}
b {font-size:12px;font-weight:bold;}
small {font-size:12px;}

</style>
</head>

<body>
<%
dim xmlDoc
dim root
dim number

Set http=Server.CreateObject("Microsoft.XMLHTTP")
http."GET","http://www.donews.com/rss.xml",False
http.send

Set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.Async=False
xmlDoc.ValidateOnParse=False
xmlDoc.Load(http.ResponseXML)

set root=xmlDoc.documentElement
number=root.selectNodes("channel/item").length

if number<=10 then
%>
<script language="vbscipt">
msgbox "对不起,该新闻条数已经少于要显示的新闻条数!"
</script>
<%
else
response.write "<p align='center' class='font'>" & root.childNodes(0).childNodes(0).text & "<p>"
response.write "<p class='indent'>" & root.childNodes(0).childNodes(1).text & "</p>"
response.write "<p class='indent'>" & root.childNodes(0).childNodes(2).text & "</p>"

for i=0 to 9
response.write "<b>" & root.childNodes(0).childNodes(5+i).childNodes(0).text & "</b><br/><br/>"
response.write "<small>" & root.childNodes(0).childNodes(5+i).childNodes(4).text & root.childNodes(0).childNodes(5+i).childNodes(3).text & "</small><br/>"
response.write "<small><a href='" & root.childNodes(0).childNodes(5+i).childNodes(1).text & "'>" & root.childNodes(0).childNodes(5+i).childNodes(1).text & "</a></small><br/><br/>"
response.write "<p class='indent'>" & root.selectNodes("channel/item/description")(i).text & "</p><br/><br/>"
next
end if
%>
</body>
</html>

Tags (标签) 引用通告地址 (0)  
Tags: Asp | Rss
复制引用地址http://www.gogogo8.com/ver2/Blog/trackback.asp?tbID=67
复制引用地址http://www.gogogo8.com/ver2/Blog/trackback.asp?tbID=67&CP=GBK
暂时没有评论
发表评论 - 注意输入验证码![本站已启用NoFollow标签]
作者:
用户:  密码:   注册?  验证:  
评论:

禁止表情
禁止UBB
禁止图片
识别链接
识别关键字
表  情
 
18 active user(s) in 10 minites. 0 member(s). 18 guest(s). 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 游客 Guest 回到页面顶部
Mainly Powered by L-Blog , Styled & Modified by water . © 2005 . Processed in 0.062500 second(s) , 10 queries .
Name : Water  QQ : 26998026  MSN : linweb  Web : http://www.gogogo8.com/ 
用户名:   

密   码:   
     IT新动态 (45) RSS 2.0
     平面设计 (164) RSS 2.0
     VS 2005 (5) RSS 2.0
     动画制作 (40) RSS 2.0
     网页制作 (81) RSS 2.0
     编程开发 (59) RSS 2.0
     帮助文档 (7) RSS 2.0
     品吧好站 (30) RSS 2.0
     乱七八糟 (42) RSS 2.0

   

   

     2005年, 12月份
     2005年, 11月份
     2005年, 10月份
     2005年, 9月份
     2005年, 5月份
     2005年, 4月份
     2005年, 3月份
     2005年, 2月份
     2005年, 1月份


 
BLOG编码找找吧
共同创作协议RSS 2.0
找找吧 | Http://www.gogogo8.com/--为广大WEB设计、制作、开发爱好者提供原创并搜集精品文章的小站:平面设计-动画制作-网页制作-编程开发 Archive

gogogo8.com v 4_3