Calling the XML data of NetEase News is used as an example to explain how to remotely call the XML file through ASP and read out the data. In fact, we have used asp to read Alexa's official data before. Copy the code code as follows:
<%
URL=http://news.163.com/special/00011K6L/rss_newstop.xml
Set xml = Server.CreateObject(Microsoft.XMLHTTP)
xml.Open GET, url, False
xml.Send
Set xmlDom = server.createObject(microsoft.xmldom)
xmlDom.async=False
xmlDom.ValidateOnParse=false
xmlDom.load(xml.responseXML)
if xmlDom.ReadyState>2 Then
set oItem=xmlDom.getElementsByTagName(item)
%>
<table width=550 border=0 cellpadding=3 cellspacing=1 bgcolor=#ECEFF4>
<%
for i=0 to oItem.length-1
word=oItem(i).childNodes(0).text
title=oItem(i).childNodes.item(0).text
Link=oItem(i).childNodes.item(1).text
pubDate=oItem(i).childNodes.item(3).text
%>
<tr>
<td height=24 bgcolor=#FFFFFF>·<a href=<%=link%> target=_blank><font style=font-size:14px; color=#003366><%=word%> </font> <font color=#999999>(<%=pubdate%>)</font></a></td>
</tr>
<%
next
end if
%>
</table>
The contents of the remote file are as follows:
Copy the code code as follows:
<?xml version=1.0 encoding=GBK?>
<?xml-stylesheet type=text/css href=http://news.163.com/css/allrss.css?>
<rss version=2.0>
<channel>
<title>NetEase headlines</title>
<link>http://news.163.com/</link>
<description>NetEase headlines</description>
<pubDate>Wed, 16 Feb 2011 02:59:02 GMT</pubDate>
<lastBuildDate>Wed, 16 Feb 2011 02:59:02 GMT</lastBuildDate>
<item id=1>
<title><![CDATA[Rents in first-tier cities continue to rise]]></title>
<link>http://news.163.com/11/0216/10/6T0NIHOA00014JB6.html</link>
<description><! [CDATA[The wave of rent increases that started at the end of last year has continued to amplify after the Spring Festival. Reporters have been exposed to news of rising rents after the Spring Festival. The rents of houses in first-tier cities such as Beijing, Shanghai, and Guangzhou continue to rise. After the new year, many agents have refreshed the rental prices of houses from a year ago. The rents of houses, shops, and office buildings have all increased. It rose by about 10%. The reporter visited a number of intermediaries in Guangzhou yesterday. The intermediaries generally reported that the leasing market was hot, and the number of rent orders in the transaction list was already five.]]>...</description>
<pubDate>2011-02-16 10:59:02</pubDate>
</item>
<item id=2>
<title><![CDATA[Some flour mills in Shandong have stopped production because farmers are reluctant to sell and merchants are hoarding grain]]></title>
<link>http://focus.news.163.com/11/0216/11/6T0R9MIE00011SM9.html</link>
<description><! [CDATA[Food is the most important thing for the people, and the price of food is the basis of a hundred prices. The rise in grain prices that began in the second half of 2010 triggered a chain reaction in the Chinese economy. The severe drought in the north since last autumn has intensified expectations for rising grain prices. Recently, international grain prices have repeatedly hit new highs. Stabilizing prices has become the top priority for China's economy this year. During the Spring Festival, Premier Wen Jiabao made a special trip to major grain-producing areas to give the latest instructions, and the State Council executive meeting quickly issued ten national regulations to protect grain production. So]]>......</description>
<pubDate>2011-02-16 11:30:40</pubDate>
</item>
</channel>
</rss>