notícias

<%
' Script ASP Para leitura de arquivos de RSS.
url = "http://www.euquerotrabalharnogoogle.com/feed/" '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

' Retirar espaços
objXML.preserveWhiteSpace = false

blnLoaded = objXML.Load(url)


'Condição caso não tenha notícias no RSS
If Not blnLoaded Then

   Response.write "Nenhuma notícia na fonte!"
Else
 
  set objNodeList = objXML.getElementsByTagName("channel")


  For Each objNode In objNodeList
    For Each objNode2 In objNode.childNodes


    Select Case objNode2.nodeName
   
 Case "title"
      'Define Propriedades do Titulo
   html = html &"<tr class='texto'><td><b>"
      html = html &objNode2.firstChild.nodevalue
      html = html &"</b></td></tr>"
   
 Case "link"
  'Define Propriedades do link    
      html = html &"<tr class='texto'><td><a target=_blank href="& objNode2.firstChild.nodevalue &">"
      html = html & objNode2.firstChild.nodevalue
      html = html &"</a></td></tr>"
   
 Case "description"
  'Está desabilitado para exibir apenas os links
      html = html &"<tr class='texto'><td><i>"
      html = html & objNode2.firstChild.nodevalue
      html = html &"</i></td></tr>"
    End Select
    Next
  Next

  html = html &"<tr><td><hr></td></tr>"

  Set objNodeList = objXML.getElementsByTagName("item")
 
' response.Write(objNodeList)
 
  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 &"<tr class='texto'><td><li/><b><a target=_blank href="& strURL &">"& strTitle &"</a></b><br>"& strDescription &"</td></tr>"
    strTitle = ""
    strURL = ""
    strDescription = ""
  Next
 'Variável onde gardamos o conteúdo do RSS
  html = "<table>"& html &"</table>"
  set objNodeList = Nothing
End if
%>
<html>
<head>
<style type="text/css">
<!--
.texto {
 font-family: Verdana;
 font-size: 11px;
 color: #000000;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
  <td>
 <span class="texto">
   
 <%
 'Exibindo notícias do RSS escolhido
 Response.write (html)
 %>
 </span>
  </td>
 </tr>
</table>
</body>
</html>