É o seguinte, estou tentando ler as notícias rss do UOL em meu site(em ASP), estou usando um código que achei aqui no forum(segue abaixo), porém ele dá erro quando o XML fonte é do uol.
Microsoft VBScript runtime error '800a01a8'
Object required: '[object]'
/jornal 2007/HTML/Html/lerrss.asp, line 40
Linha 40:
strDescription = objNode2.firstChild.nodevalue
Código que estou usando:
<%
' Script ASP Para leitura de arquivos de RSS.
url = "http://rss.vestibular.uol.com.br/ultnot/index.xml" 'Aqui vai o endereço do arquivo RSS, ou do arquivo "gerador"
' Criando Objeto XML
Set objXML = Server.CreateObject("msxml2.DOMDocument.3.0")
objXML.async = false
objXML.setProperty "ServerHTTPRequest", True
' Não validar o arquivo
objXML.validateOnParse =false' true
' Retirar espaços
objXML.preserveWhiteSpace = false
blnLoaded = objXML.Load(url)
If Not blnLoaded Then
Response.write "Nenhuma notícia na fonte!"
Else
set objNodeList = objXML.getElementsByTagName("channel")
Set objNodeList = objXML.getElementsByTagName("item")
For Each objNode In objNodeList
For Each objNode2 In objNode.childNodes
Select Case objNode2.nodeName
Case "title"
strTitle = objNode2.firstChild.nodevalue
Case "link"
strURL = objNode2.firstChild.nodevalue
Case "description"
strDescription = objNode2.firstChild.nodevalue
End Select
Next
html = html &"<b><a target=_blank href="& strURL &" class='t11cs' style='text-decoration:none' onMouseOver='window.status=' Clique para ver a notícia completa!';return true;' onMouseOut='window.status='';return true;'><font color='#666666'>"& strTitle &"</a> :: </font></b>"
strTitle = ""
strURL = ""
strDescription = ""
Next
html = "<p><marquee scrollamount='1' scrolldelay='2' style='font-family: Tahoma; font-size: 11px' width='700' height='13'>"& html &"</marquee></p>"
set objNodeList = Nothing
End if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<%
Response.write (html)
%>
</body>
</html>
Pergunta
fabiomcg
Olá galera do forum, agradeço a atenção!
É o seguinte, estou tentando ler as notícias rss do UOL em meu site(em ASP), estou usando um código que achei aqui no forum(segue abaixo), porém ele dá erro quando o XML fonte é do uol.
alguém pode me ajudar?
Agradeço.
Fonte XML: http://rss.vestibular.uol.com.br/ultnot/index.xml
O erro é o seguinte:
Linha 40: Código que estou usando:<% ' Script ASP Para leitura de arquivos de RSS. url = "http://rss.vestibular.uol.com.br/ultnot/index.xml" 'Aqui vai o endereço do arquivo RSS, ou do arquivo "gerador" ' Criando Objeto XML Set objXML = Server.CreateObject("msxml2.DOMDocument.3.0") objXML.async = false objXML.setProperty "ServerHTTPRequest", True ' Não validar o arquivo objXML.validateOnParse =false' true ' Retirar espaços objXML.preserveWhiteSpace = false blnLoaded = objXML.Load(url) If Not blnLoaded Then Response.write "Nenhuma notícia na fonte!" Else set objNodeList = objXML.getElementsByTagName("channel") Set objNodeList = objXML.getElementsByTagName("item") For Each objNode In objNodeList For Each objNode2 In objNode.childNodes Select Case objNode2.nodeName Case "title" strTitle = objNode2.firstChild.nodevalue Case "link" strURL = objNode2.firstChild.nodevalue Case "description" strDescription = objNode2.firstChild.nodevalue End Select Next html = html &"<b><a target=_blank href="& strURL &" class='t11cs' style='text-decoration:none' onMouseOver='window.status=' Clique para ver a notícia completa!';return true;' onMouseOut='window.status='';return true;'><font color='#666666'>"& strTitle &"</a> :: </font></b>" strTitle = "" strURL = "" strDescription = "" Next html = "<p><marquee scrollamount='1' scrolldelay='2' style='font-family: Tahoma; font-size: 11px' width='700' height='13'>"& html &"</marquee></p>" set objNodeList = Nothing End if %> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> </head> <body> <% Response.write (html) %> </body> </html>Link para o comentário
Compartilhar em outros sites
3 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.