Здравствуйте, Shroo, Вы писали:
S> Добрый день!
S> Появилась следующая задача. Распарсить rss на обычном ASP.
<%@ CODEPAGE=65001 %>
<%
'ASP-файл сохранять в UTF-8!!!
Response.Charset = "utf-8"
Function LoadRSS(RSS_link)
Set http = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
http.open "GET", RSS_link, False
http.setRequestHeader "User-Agent", "agent007"
http.send
Set xmlDoc = http.ResponseXML
Set http = Nothing
'или можно ещё так, работает намного надежнее:
'set xmlDoc = Server.CreateObject("Msxml2.DOMDocument")
'xmlDoc.async = false
'xmlDoc.setProperty "ServerHTTPRequest", true
'xmlDoc.validateOnParse = false
'xmlDoc.load RSS_link
if xmlDoc.parseError.errorCode <> 0 then
Set myErr = xmlDoc.parseError
Response.write(myErr.reason)
Exit Function
end if
Set objNodeList = xmlDoc.getElementsByTagName("channel")
Set objNode = objNodeList.item(0)
If TypeName(objNode.selectSingleNode("title")) <> "Nothing" then
ch_title = objNode.selectSingleNode("title").text
End if
Set XmlDoc = Nothing
Set objNodeList = Nothing
Set objNode = Nothing
Response.write(ch_title)
End Function
%>