<% @ Language = "VBScript" %>
<%
Function readrss (xmlseed)
Dim xmldoc
Dim HTTP
Set HTTP = server. Createobject ("Microsoft. XMLHTTP ")
HTTP. Open "get", xmlseed, false
HTTP. Send
Set xmldoc = server. Createobject ("Microsoft. xmldom ")
Xmldoc. async = false
Xmldoc. validateonparse = false
Xmldoc. Load (HTTP. responsexml)
Set item = xmldoc. getelementsbytagname ("item ")
If item. Length <= 10 then
%>
<Script language = "JavaScript">
Alert ("sorry, the number of news lines is already less than 10! ");
</SCRIPT>
<%
Else
For I = 0 to (item. Length-1)
Set Title = item. Item (I). getelementsbytagname ("title ")
Set link = item. Item (I). getelementsbytagname ("Link ")
Response. write ("<a href =" "& link. item (0 ). text & "target = '_ blank'>" & title. item (0 ). text & "</a> <br> ")
Next
End if
End Function
%>
<HTML>
<Head>
<Title> remote XML file reading </title>
</Head>
<Body>
<%
Call readrss ("http://rss.sina.com.cn/news/allnews/tech.xml ")
%>
<Br>
<%
Call readrss ("http://rss.sina.com.cn/news/allnews/astro.xml ")
%>
</Body>
</Html>
========================================================== ==============================================
<HTML>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Title> Read XML </title>
<Body>
<%
Dim xmlurl
Xmlurl = "http://rss.sina.com.cn/news/allnews/tech.xml" 'the XML file you want to read
Dim HTTP
Dim node, I, nodecount
Set HTTP = server. Createobject ("msxml2.xmlhttp ")
HTTP. Open "get", xmlurl, false
HTTP. Send
Set Doc = server. Createobject ("Microsoft. xmldom ")
Doc. async = false
Doc. validateonparse = false
Doc. Load (HTTP. responsexml)
Set nodelis = Doc. getelementsbytagname ("item ")
%>
<Table border = "0" width = "80%" align = "center">
<Tr>
<TD width = "40%" type = "codeph" text = "codeph"> <B> Article Name </B> </TD>
<TD width = "20%"> <B> publication date </B> </TD>
<TD width = "40%"> <B> Category </B> </TD>
</Tr>
<%
For I = 0 to nodelis. Length-1
If nodelis (I). selectsinglenode ("category") is nothing then exit
%>
<Tr> <TD colspan = 3> <font color = Red> record <% = I + 1%>: </font> </TD> </tr>
<Tr>
<TD>
<% = Nodelis (I). selectsinglenode ("title"). Text %>
</TD>
<TD>
<% = Nodelis (I). selectsinglenode ("category"). Text %>
</TD>
<TD>
<% = Nodelis (I). selectsinglenode ("pubdate"). Text %>
</TD>
</Tr>
<%
Next
Set Doc = nothing
%>
</Table>
</Body>
</Html>