Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
OLÁ, alguém utiliza essa função de leitura de RSS:
Function fnRSSReader(RSSFile, XSLFile)
'Original Author:Rafay Bin Ali
'Original Author Email: rafayali@gmail.com
'Original Author Blog: http://rafayali.blogspot.com
'Original Author Website: http://cc.1asphost.com/powerwebdev/index.htm
'Adaptation by: Ronaldo Storck - http://www.tenq.com.br
'Monitorado por: Tenq! - Gestão para WEB
if RSSFile <> "" AND XSLFile <> "" then
set objXML=server.createObject("MSXML2.DOMDocument.6.0")
objXML.async=false
objXML.load(RSSFile)
if objXML.parseError.errorCode <> 0 then
response.write "No momento a fonte de dados das notícias está fora do ar. -> "
Response.Write(objXML.parseError.reason)
Response.Write(objXML.parseError.errorCode)
end if
set objXSL=server.createObject("MSXML2.DOMDocument.6.0")
objXSL.async=false
objXSL.load(XSLFile)
if objXSL.parseError.errorCode <> 0 then
response.write "O arquivo de layout .xsl não foi encontrado"
end if
response.write(objXML.transformNode(objXSL))
else
response.write("Deve ser usada a sintaxe correa para acessar o canal RSS")
end if
End Function
Chamando:
RSSFile = "http://g1.globo.com/dynamo/brasil/rss2.xml"
XSLFile = Server.MapPath("noticias.xsl")
Response.Write(fnRSSReader(RSSFile, XSLFile))
Funcionava bem o o DOMDocument 3, agora que passei para um servidor com a versão 6, está dando o erro:
The download of the specified resource has failed. -2146697208
Pode ser alguma coisa com a versão do xml?
obrigado...
Está ok, abri o arquivo diretamente várias vezes durante o dia... não sei o cabeçalho do xml tem algo a ver, penso que não... sobre o componente, ele está instanciando normalmente...
sds
verifique se existe alguma instabilidade no server.
Tem alguma forma de chegar isso via programação, pois entrei em contato com o suporte e me disseram que o servidor está ok (de onde hospedo o site), e já tentei várias vezes... conhece alguma outra função para ler esses rss ?
teste esse aqui, com o rss que esta nele
<!-- #include file="Classe_LeitorRSS.asp" -->
<%
Dim objLeitorRSS
Dim Mensagem
Dim Cont
Dim objRSSChannel
Set objLeitorRSS = New LeitorRSS
Mensagem = ""
If Not objLeitorRSS.ReadURL("http://rss.terra.com.br/0,,EI4795,00.xml") Then
Mensagem = objLeitorRSS.MensagemErro
Else
Set objRSSChannel = New Channel
Set objRSSChannel = objLeitorRSS.RSSChannel
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Leitor RSS 2.0</title>
</head>
<body>
<center>
<table border="0" cellpadding="0" bgcolor="#000000" cellspacing="1" width="500" height="100%"><tr><td valign="top">
<table border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" width="500" height="100%">
<%If Not Mensagem = "" Then%>
<tr><td height="100%" valign="top"><font face="verdana" size="2" color="#ff8500"><%=Mensagem%></font></td></tr>
<%Else%>
<tr bgcolor="#000000">
<td align="center" valign="middle" height="35" colspan="2">
<strong><a href="<%=objRSSChannel.Link%>"><font face="verdana" size="2" color="#ff8500"><%=objRSSChannel.Title%></font></a></strong>
<br>
<font face="verdana" size="1" color="#ff8500"><%=objRSSChannel.PubDate%></font>
</td>
<tr>
<tr bgcolor="#f0f0f0">
<td valign="top" height="1%">
<a href="<%=objRSSChannel.Image.Link%>"><img src="<%=objRSSChannel.Image.Url%>" alt="<%=objRSSChannel.Image.Title%>" border="0" align=baseline></a>
</td>
<td align="left" valign="top" height="10">
<font face="verdana" size="2" color="#000000"><%=objRSSChannel.Description%></font>
</td>
<tr>
<tr><td> </td></tr>
<%
For Cont = 1 To objRSSChannel.Item.Count%>
<tr>
<td height="10" width="100%" colspan="2">
<font face="verdana" size="2" color="#000000">
<a href="<%=objRSSChannel.Item.Item(Cont).Link%>"><strong><%=objRSSChannel.Item.Item(Cont).Title%></strong></a>
<br>
<font size="1" color="#808080"><i><%=objRSSChannel.Item.Item(Cont).PubDate%></i></font>
<br>
<font size="1"><%=objRSSChannel.Item.Item(Cont).Description%></font>
<br>
<tt>Source: <%=objRSSChannel.Item.Item(Cont).Source.Url%></tt>
</font>
<p>
</td>
</tr>
<%Next%>
<%
Set objRSSChannel = Nothing
End If
%>
<tr><td height="100%"> </td></tr>
</table>
</td></tr></table>
</center>
</body>
</html>
<%
Set objLeitorRSS = Nothing
%><%Option Explicit%>
<script language="vbscript" runat="server">
'*******************************************************
'CLASSE RESPONSÁVEL PELA LEITURA DE RSS
'*******************************************************
Class LeitorRSS
'-----------------------------------------------------
'ATRIBUTOS DA CLASSE
'-----------------------------------------------------
'Obrigatórios
Private a_MensagemErro
Private a_Channel
'-----------------------------------------------------
'PROPRIEDADES DA CLASSE
'-----------------------------------------------------
Public Property Get MensagemErro
MensagemErro = a_MensagemErro
End Property
Private Property Let MensagemErro(ByVal p_objXmlParseerror)
a_MensagemErro = Server.HTMLEncode(p_objXmlParseerror.srcText) & "<br>" & p_objXmlParseerror.Reason & " (Line " & p_objXmlParseerror.Line & ", Column " & p_objXmlParseerror.Linepos & ")"
End Property
Public Property Get RSSChannel
Set RSSChannel = a_Channel
End Property
'-----------------------------------------------------
'MÉTODOS DE CRIAÇÃO E DESTRUIÇÃO DA CLASSE
'-----------------------------------------------------
Private Sub Class_Initialize()
'Inicializando o objeto Channel
Set a_Channel = New Channel
End Sub
Private Sub Class_Terminate()
'Destruindo o objeto Channel
Set a_Channel = Nothing
End Sub
'-----------------------------------------------------
'MÉTODOS DA CLASSE
'-----------------------------------------------------
'-----------------------------------------------------
'Funcao: ReadURL(ByVal strURL)
'Sinopse: Faz a Leitura da URL contendo o RSS
' e carrega os dados do formato XML nos
' objetos.
'Parametro:
' strURL: URL contendo o conteúdo XML-RSS 2.0
'Retorno: Boolean
'-----------------------------------------------------
Public Function ReadURL(ByVal strURL)
'Declaração
Dim objXml
Dim objXmlChannels
Dim objXmlChannelsNos
Dim objXmlNode
Dim objXmlNode2
Dim objXmlNode3
Dim objXmlSubNode
Dim objXmlSubNode2
Dim objXmlSubNodedes
Dim objXmlSubNodede
Dim objXmlHttp
Dim objChannelItem
Dim XmlDoc
Dim i, j, t
'Inicialização dos objetos
Set objXmlHttp = Server.CreateObject("MSXML2.XMLHTTP")
Set objXml = Server.CreateObject("MSXML2.DOMDOCUMENT")
'Resgatando os dados do XML via Http
objXMLHttp.Open "GET", strURL, False
Call objXMLHttp.Send()
XmlDoc = BinaryToString(objXmlHttp.ResponseBody)
'Abrindo o XML
objXml.ValidateOnParse = True
objXml.Async = False
objXml.LoadXML(XmlDoc)
'Verificando se é um XML válido.
If objXml.ParseError.ErrorCode <> 0 Then
MensagemErro = objXml.ParseError
'Destruindo os objetos
Set objXmlHttp = Nothing
Set objXml = Nothing
'Saindo da função
ReadURL = False
Exit Function
End If
'......................................................
'Populando os dados
'......................................................
'CHANNEL
Set objXmlChannels = objXml.getElementsByTagName("channel")
Set objXmlChannelsNos = objXmlChannels.Item(0).childNodes
'Looping nos nós da channel
For i = 0 To objXmlChannelsNos.Length-1
Set objXmlNode = objXmlChannelsNos.Item(i)
Select Case Lcase(objXmlNode.TagName)
Case "title"
a_Channel.Title = objXmlNode.Text
Case "link"
a_Channel.Link = objXmlNode.Text
Case "description"
a_Channel.Description = objXmlNode.Text
Case "language"
a_Channel.Language = objXmlNode.Text
Case "copyright"
a_Channel.Copyright = objXmlNode.Text
Case "managingeditor"
a_Channel.ManagingEditor = objXmlNode.Text
Case "webmaster"
a_Channel.WebMaster = objXmlNode.Text
Case "pubdate"
a_Channel.PubDate = objXmlNode.Text
Case "lastbuilddate"
a_Channel.LastBuildDate = objXmlNode.Text
Case "lastbuilddate"
a_Channel.LastBuildDate = objXmlNode.Text
Case "category"
a_Channel.Category = objXmlNode.Text
Case "generator"
a_Channel.Generator = objXmlNode.Text
Case "cloud"
'Resgatando os Sub-elementos do nó cloud
Set objXmlSubNode = objXmlNode.childNodes
For j = 0 To objXmlSubNode.Length-1
Set objXmlNode2 = objXmlSubNode.Item(j)
Select Case Lcase(objXmlNode2.tagName)
Case "domain"
a_Channel.Cloud.Domain = objXmlNode2.Text
Case "port"
a_Channel.Cloud.Port = objXmlNode2.Text
Case "path"
a_Channel.Cloud.Path = objXmlNode2.Text
Case "registerprocedure"
a_Channel.Cloud.RegisterProcedure = objXmlNode2.Text
Case "protocol"
a_Channel.Cloud.Protocol = objXmlNode2.Text
End Select
Set objXmlNode2 = Nothing
Next
Case "ttl"
a_Channel.Ttl = objXmlNode.Text
Case "image"
'Resgatando os Sub-elementos do nó image
Set objXmlSubNode = objXmlNode.childNodes
For j = 0 To objXmlSubNode.Length-1
Set objXmlNode2 = objXmlSubNode.Item(j)
Select Case Lcase(objXmlNode2.tagName)
Case "url"
a_Channel.Image.Url = objXmlNode2.Text
Case "title"
a_Channel.Image.Title = objXmlNode2.Text
Case "link"
a_Channel.Image.Link = objXmlNode2.Text
Case "width"
a_Channel.Image.Width = objXmlNode2.Text
Case "height"
a_Channel.Image.Height = objXmlNode2.Text
End Select
Set objXmlNode2 = Nothing
Next
Case "textinput"
'Resgatando os Sub-elementos do nó textinput
Set objXmlSubNode = objXmlNode.childNodes
For j = 0 To objXmlSubNode.Length-1
Set objXmlNode2 = objXmlSubNode.Item(j)
Select Case Lcase(objXmlNode2.tagName)
Case "title"
a_Channel.TextInput.Title = objXmlNode2.Text
Case "description"
a_Channel.TextInput.Description = objXmlNode2.Text
Case "name"
a_Channel.TextInput.Name = objXmlNode2.Text
Case "link"
a_Channel.TextInput.Link = objXmlNode2.Text
End Select
Set objXmlNode2 = Nothing
Next
Case "skiphours"
a_Channel.SkipHours = objXmlNode.Text
Case "skipdays"
a_Channel.SkipDays = objXmlNode.Text
Case "item"
'Resgatando os Sub-elementos do nó item
Set objXmlSubNode = objXmlNode.childNodes
Set objChannelItem = New ChannelItem
For j = 0 To objXmlSubNode.Length-1
Set objXmlNode2 = objXmlSubNode.Item(j)
Select Case Lcase(objXmlNode2.tagName)
Case "title"
objChannelItem.Title = objXmlNode2.Text
Case "link"
objChannelItem.Link = objXmlNode2.Text
Case "description"
objChannelItem.Description = objXmlNode2.Text
Case "author"
objChannelItem.Author = objXmlNode2.Text
Case "category"
'Resgatando os Sub-elementos do nó item/category
Set objXmlSubNode2 = objXmlNode2.childNodes
For t = 0 To objXmlSubNode2.Length-1
Set objXmlNode3 = objXmlSubNode2.Item(t)
Select Case Lcase(objXmlNode3.tagName)
Case "description"
objChannelItem.Category.Description = objXmlNode3.Text
Case "domain"
objChannelItem.Category.Domain = objXmlNode3.Text
End Select
Set objXmlNode3 = Nothing
Next
Set objXmlSubNode2 = Nothing
Case "comments"
objChannelItem.Comments = objXmlNode2.Text
Case "enclosure"
'Resgatando os Sub-elementos do nó item/enclosure
Set objXmlSubNode2 = objXmlNode2.childNodes
For t = 0 To objXmlSubNode2.Length-1
Set objXmlNode3 = objXmlSubNode2.Item(t)
Select Case Lcase(objXmlNode3.tagName)
Case "url"
objChannelItem.Enclosure.Url = objXmlNode3.Text
Case "length"
objChannelItem.Enclosure.Length = objXmlNode3.Text
Case "etype"
objChannelItem.Enclosure.EType = objXmlNode3.Text
End Select
Set objXmlNode3 = Nothing
Next
Set objXmlSubNode2 = Nothing
Case "guid"
'Resgatando os Sub-elementos do nó item/guid
Set objXmlSubNode2 = objXmlNode2.childNodes
For t = 0 To objXmlSubNode2.Length-1
Set objXmlNode3 = objXmlSubNode2.Item(t)
Select Case Lcase(objXmlNode3.tagName)
Case "description"
objChannelItem.Guid.Description = objXmlNode3.Text
Case "ispermalink"
objChannelItem.Guid.IsPermaLink = objXmlNode3.Text
End Select
Set objXmlNode3 = Nothing
Next
Set objXmlSubNode2 = Nothing
Case "pubdate"
objChannelItem.PubDate = objXmlNode2.Text
Case "source"
'Resgatando os Sub-elementos do nó item/source
Set objXmlSubNode2 = objXmlNode2.childNodes
For t = 0 To objXmlSubNode2.Length-1
Set objXmlNode3 = objXmlSubNode2.Item(t)
Select Case Lcase(objXmlNode3.tagName)
Case "description"
objChannelItem.Source.Description = objXmlNode3.Text
Case "url"
objChannelItem.Source.Url = objXmlNode3.Text
End Select
Set objXmlNode3 = Nothing
Next
Set objXmlSubNode2 = Nothing
End Select
Set objXmlNode2 = Nothing
Next
'Adicionando o Item na Coleção
Call a_Channel.AddItem(objChannelItem)
Set objChannelItem = Nothing
End Select
Set objXmlNode = Nothing
Next
'......................................................
'Destruindo os objetos
Set objXml = Nothing
Set objXmlHttp = Nothing
'Retornando a função
ReadURL = True
End Function
Public Function BinaryToString(xBinary)
Dim Binary
Dim RS, LBinary
If VarType(xBinary)=8 Then Binary = MultiByteToBinary(xBinary) Else Binary = xBinary
Const adLongVarChar = 201
Set RS = CreateObject("ADODB.Recordset")
LBinary = LenB(Binary)
If LBinary>0 Then
RS.Fields.Append "mBinary", adLongVarChar, LBinary
RS.Open
RS.AddNew
RS("mBinary").AppendChunk Binary
RS.Update
BinaryToString = RS("mBinary")
Else
BinaryToString = ""
End If
Set RS = Nothing
End Function
Public Function MultiByteToBinary(MultiByte)
Dim RS, LMultiByte, Binary
Const adLongVarBinary = 205
Set RS = CreateObject("ADODB.Recordset")
LMultiByte = LenB(MultiByte)
If LMultiByte>0 Then
RS.Fields.Append "mBinary", adLongVarBinary, LMultiByte
RS.Open
RS.AddNew
RS("mBinary").AppendChunk MultiByte & ChrB(0)
RS.Update
Binary = RS("mBinary").GetChunk(LMultiByte)
End If
Set RS = Nothing
MultiByteToBinary = Binary
End Function
End Class
'*******************************************************
'*******************************************************
'CLASSE CHANNEL
'*******************************************************
Class Channel
'-----------------------------------------------------
'ATRIBUTOS DA CLASSE
'-----------------------------------------------------
'Obrigatórios
Private a_Title
Private a_Link
Private a_Description
'Opcionais
Private a_Language
Private a_Copyright
Private a_ManagingEditor
Private a_WebMaster
Private a_PubDate
Private a_LastBuildDate
Private a_Category
Private a_Generator
Private a_Docs
Private a_Cloud
Private a_Ttl
Private a_Image
Private a_TextInput
Private a_SkipHours
Private a_SkipDays
Private a_Item
'-----------------------------------------------------
'PROPRIEDADES DA CLASSE
'-----------------------------------------------------
Public Default Property Get Title
Title = a_Title
End Property
Public Property Let Title(ByVal p_Title)
a_Title = p_Title
End Property
Public Property Get Link
Link = a_Link
End Property
Public Property Let Link(ByVal p_Link)
a_Link = p_Link
End Property
Public Property Get Description
Description = a_Description
End Property
Public Property Let Description(ByVal p_Description)
a_Description = p_Description
End Property
Public Property Get Language
Language = a_Language
End Property
Public Property Let Language(ByVal p_Language)
a_Language = p_Language
End Property
Public Property Get Copyright
Copyright = a_Copyright
End Property
Public Property Let Copyright(ByVal p_Copyright)
a_Copyright = p_Copyright
End Property
Public Property Get ManagingEditor
ManagingEditor = a_ManagingEditor
End Property
Public Property Let ManagingEditor(ByVal p_ManagingEditor)
a_ManagingEditor = p_ManagingEditor
End Property
Public Property Get WebMaster
WebMaster = a_WebMaster
End Property
Public Property Let WebMaster(ByVal p_WebMaster)
a_WebMaster = p_WebMaster
End Property
Public Property Get PubDate
PubDate = a_PubDate
End Property
Public Property Let PubDate(ByVal p_PubDate)
a_PubDate = p_PubDate
End Property
Public Property Get LastBuildDate
LastBuildDate = a_LastBuildDate
End Property
Public Property Let LastBuildDate(ByVal p_LastBuildDate)
a_LastBuildDate = p_LastBuildDate
End Property
Public Property Get Category
Category = a_Category
End Property
Public Property Let Category(ByVal p_Category)
a_Category = p_Category
End Property
Public Property Get Generator
Generator = a_Generator
End Property
Public Property Let Generator(ByVal p_Generator)
a_Generator = p_Generator
End Property
Public Property Get Docs
Docs = a_Docs
End Property
Public Property Let Docs(ByVal p_Docs)
a_Docs = p_Docs
End Property
Public Property Get Cloud
Set Cloud = a_Cloud
End Property
Public Property Get Ttl
Ttl = a_Ttl
End Property
Public Property Let Ttl(ByVal p_Ttl)
a_Ttl = p_Ttl
End Property
Public Property Get Image
Set Image = a_Image
End Property
Public Property Get TextInput
Set TextInput = a_TextInput
End Property
Public Property Get SkipHours
SkipHours = a_SkipHours
End Property
Public Property Let SkipHours(ByVal p_SkipHours)
a_SkipHours = p_SkipHours
End Property
Public Property Get SkipDays
SkipDays = a_SkipDays
End Property
Public Property Let SkipDays(ByVal p_SkipDays)
a_SkipDays = p_SkipDays
End Property
Public Property Get Item
Set Item = a_Item
End Property
'-----------------------------------------------------
'MÉTODOS DE CRIAÇÃO E DESTRUIÇÃO DA CLASSE
'-----------------------------------------------------
Private Sub Class_Initialize()
'Inicializando as propriedades que são multivaloradas
Set a_Image = New ChannelImage
Set a_Cloud = New ChannelCloud
Set a_TextInput = New ChannelTextInput
Set a_Item = Server.CreateObject("Scripting.Dictionary")
End Sub
Private Sub Class_Terminate()
'Destruindo as propriedades que são multivaloradas
Set a_Item = Nothing
Set a_TextInput = Nothing
Set a_Cloud = Nothing
Set a_Image = Nothing
End Sub
'-----------------------------------------------------
'MÉTODOS DA CLASSE
'-----------------------------------------------------
'-----------------------------------------------------
'Funcao: AddItem(ByVal p_objChannelItem)
'Sinopse: Adiciona um novo Item na Coleção de Itens
'Parametro:
' objChannelItem: Objeto com os Itens
'Retorno: Boolean
'-----------------------------------------------------
Public Function AddItem(ByVal p_objChannelItem)
If TypeName(p_objChannelItem) = "ChannelItem" Then
Call a_Item.Add(a_Item.Count+1, p_objChannelItem)
AddItem = True
Else
AddItem = False
End If
End Function
End Class
'*******************************************************
'*******************************************************
'CLASSE IMAGE DO ELEMENTO CHANNEL
'*******************************************************
Class ChannelImage
'-----------------------------------------------------
'ATRIBUTOS DA CLASSE
'-----------------------------------------------------
'Obrigatórios
Private a_Url
Private a_Title
Private a_Link
'Opcionais
Private a_Width
Private a_Height
'-----------------------------------------------------
'PROPRIEDADES DA CLASSE
'-----------------------------------------------------
Public Property Get Url
Url = a_Url
End Property
Public Property Let Url(ByVal p_Url)
a_Url = p_Url
End Property
Public Property Get Title
Title = a_Title
End Property
Public Property Let Title(ByVal p_Title)
a_Title = p_Title
End Property
Public Property Get Link
Link = a_Link
End Property
Public Property Let Link(ByVal p_Link)
a_Link = p_Link
End Property
Public Property Get Width
Width = a_Width
End Property
Public Property Let Width(ByVal p_Width)
If p_Width > 144 Then
p_Width = 144
End If
a_Width = p_Width
End Property
Public Property Get Height
Height = a_Height
End Property
Public Property Let Height(ByVal p_Height)
If p_Height > 400 Then
p_Height = 400
End If
a_Height = p_Height
End Property
'-----------------------------------------------------
'MÉTODOS DE CRIAÇÃO E DESTRUIÇÃO DA CLASSE
'-----------------------------------------------------
Private Sub Class_Initialize()
'Valores Default
a_Width = 88
a_Height = 31
End Sub
Private Sub Class_Terminate()
End Sub
End Class
'*******************************************************
'*******************************************************
'CLASSE CLOUD DO ELEMENTO CHANNEL
'*******************************************************
Class ChannelCloud
'-----------------------------------------------------
'ATRIBUTOS DA CLASSE
'-----------------------------------------------------
'Obrigatórios
Private a_Domain
Private a_Port
Private a_Path
Private a_RegisterProcedure
Private a_Protocol
'-----------------------------------------------------
'PROPRIEDADES DA CLASSE
'-----------------------------------------------------
Public Property Get Domain
Domain = a_Domain
End Property
Public Property Let Domain(ByVal p_Domain)
a_Domain = p_Domain
End Property
Public Property Get Port
Port = a_Port
End Property
Public Property Let Port(ByVal p_Port)
a_Port = p_Port
End Property
Public Property Get Path
Path = a_Path
End Property
Public Property Let Path(ByVal p_Path)
a_Path = p_Path
End Property
Public Property Get RegisterProcedure
RegisterProcedure = a_RegisterProcedure
End Property
Public Property Let RegisterProcedure(ByVal p_RegisterProcedure)
a_RegisterProcedure = p_RegisterProcedure
End Property
Public Property Get Protocol
Protocol = a_Protocol
End Property
Public Property Let Protocol(ByVal p_Protocol)
a_Protocol = p_Protocol
End Property
'-----------------------------------------------------
'MÉTODOS DE CRIAÇÃO E DESTRUIÇÃO DA CLASSE
'-----------------------------------------------------
Private Sub Class_Initialize()
End Sub
Private Sub Class_Terminate()
End Sub
End Class
'*******************************************************
'*******************************************************
'CLASSE TEXTINPUT DO ELEMENTO CHANNEL
'*******************************************************
Class ChannelTextInput
'-----------------------------------------------------
'ATRIBUTOS DA CLASSE
'-----------------------------------------------------
'Obrigatórios
Private a_Title
Private a_Description
Private a_Name
Private a_Link
'-----------------------------------------------------
'PROPRIEDADES DA CLASSE
'-----------------------------------------------------
Public Property Get Title
Title = a_Title
End Property
Public Property Let Title(ByVal p_Title)
a_Title = p_Title
End Property
Public Property Get Description
Description = a_Description
End Property
Public Property Let Description(ByVal p_Description)
a_Description = p_Description
End Property
Public Property Get Name
Name = a_Name
End Property
Public Property Let Name(ByVal p_Name)
a_Name = p_Name
End Property
Public Property Get Link
Link = a_Link
End Property
Public Property Let Link(ByVal p_Link)
a_Link = p_Link
End Property
'-----------------------------------------------------
'MÉTODOS DE CRIAÇÃO E DESTRUIÇÃO DA CLASSE
'-----------------------------------------------------
Private Sub Class_Initialize()
End Sub
Private Sub Class_Terminate()
End Sub
End Class
'*******************************************************
'*******************************************************
'CLASSE ITEM DO ELEMENTO CHANNEL
'*******************************************************
Class ChannelItem
'-----------------------------------------------------
'ATRIBUTOS DA CLASSE
'-----------------------------------------------------
'Obrigatórios
Private a_Title
Private a_Link
Private a_Description
Private a_Author
Private a_Category
Private a_Comments
Private a_Enclosure
Private a_Guid
Private a_PubDate
Private a_Source
'-----------------------------------------------------
'PROPRIEDADES DA CLASSE
'-----------------------------------------------------
Public Property Get Title
Title = a_Title
End Property
Public Property Let Title(ByVal p_Title)
a_Title = p_Title
End Property
Public Property Get Link
Link = a_Link
End Property
Public Property Let Link(ByVal p_Link)
a_Link = p_Link
End Property
Public Property Get Description
Description = a_Description
End Property
Public Property Let Description(ByVal p_Description)
a_Description = p_Description
End Property
Public Property Get Author
Author = a_Author
End Property
Public Property Let Author(ByVal p_Author)
a_Author = p_Author
End Property
Public Property Get Category
Set Category = a_Category
End Property
Public Property Get Comments
Comments = a_Comments
End Property
Public Property Let Comments(ByVal p_Comments)
a_Comments = p_Comments
End Property
Public Property Get Enclosure
Set Enclosure = a_Enclosure
End Property
Public Property Get Guid
Set Guid = a_Guid
End Property
Public Property Get PubDate
PubDate = a_PubDate
End Property
Public Property Let PubDate(ByVal p_PubDate)
a_PubDate = p_PubDate
End Property
Public Property Get Source
Set Source = a_Source
End Property
'-----------------------------------------------------
'MÉTODOS DE CRIAÇÃO E DESTRUIÇÃO DA CLASSE
'-----------------------------------------------------
Private Sub Class_Initialize()
'Inicializando as propriedades que são multivaloradas
Set a_Category = New ItemCategory
Set a_Enclosure = New ItemEnclosure
Set a_Guid = New ItemGuid
Set a_Source = New ItemSource
End Sub
Private Sub Class_Terminate()
'Destruindo as propriedades que são multivaloradas
Set a_Category = Nothing
Set a_Enclosure = Nothing
Set a_Guid = Nothing
Set a_Source = Nothing
End Sub
End Class
'*******************************************************
'*******************************************************
'CLASSE CATEGORY DO ELEMENTO ITEM
'*******************************************************
Class ItemCategory
'-----------------------------------------------------
'ATRIBUTOS DA CLASSE
'-----------------------------------------------------
'Obrigatórios
Private a_Description
'Opcionais
Private a_Domain
'-----------------------------------------------------
'PROPRIEDADES DA CLASSE
'-----------------------------------------------------
Public Property Get Description
Description = a_Description
End Property
Public Property Let Description(ByVal p_Description)
a_Description = p_Description
End Property
Public Property Get Domain
Domain = a_Domain
End Property
Public Property Let Domain(ByVal p_Domain)
a_Domain = p_Domain
End Property
'-----------------------------------------------------
'MÉTODOS DE CRIAÇÃO E DESTRUIÇÃO DA CLASSE
'-----------------------------------------------------
Private Sub Class_Initialize()
End Sub
Private Sub Class_Terminate()
End Sub
End Class
'*******************************************************
'*******************************************************
'CLASSE ENCLOSURE DO ELEMENTO ITEM
'*******************************************************
Class ItemEnclosure
'-----------------------------------------------------
'ATRIBUTOS DA CLASSE
'-----------------------------------------------------
'Obrigatórios
Private a_Url
Private a_Length
Private a_EType
'-----------------------------------------------------
'PROPRIEDADES DA CLASSE
'-----------------------------------------------------
Public Property Get Url
Url = a_Url
End Property
Public Property Let Url(ByVal p_Url)
a_Url = p_Url
End Property
Public Property Get Length
Length = a_Length
End Property
Public Property Let Length(ByVal p_Length)
a_Length = p_Length
End Property
Public Property Get EType
EType = a_EType
End Property
Public Property Let EType(ByVal p_EType)
a_EType = p_EType
End Property
'-----------------------------------------------------
'MÉTODOS DE CRIAÇÃO E DESTRUIÇÃO DA CLASSE
'-----------------------------------------------------
Private Sub Class_Initialize()
End Sub
Private Sub Class_Terminate()
End Sub
End Class
'*******************************************************
'*******************************************************
'CLASSE GUID DO ELEMENTO ITEM
'*******************************************************
Class ItemGuid
'-----------------------------------------------------
'ATRIBUTOS DA CLASSE
'-----------------------------------------------------
'Obrigatórios
Private a_Description
'Opcionais
Private a_IsPermaLink
'-----------------------------------------------------
'PROPRIEDADES DA CLASSE
'-----------------------------------------------------
Public Property Get Description
Description = a_Description
End Property
Public Property Let Description(ByVal p_Description)
a_Description = p_Description
End Property
Public Property Get IsPermaLink
IsPermaLink = a_IsPermaLink
End Property
Public Property Let IsPermaLink(ByVal p_IsPermaLink)
a_IsPermaLink = p_IsPermaLink
End Property
'-----------------------------------------------------
'MÉTODOS DE CRIAÇÃO E DESTRUIÇÃO DA CLASSE
'-----------------------------------------------------
Private Sub Class_Initialize()
'Valores Default
a_IsPermaLink = True
End Sub
Private Sub Class_Terminate()
End Sub
End Class
'*******************************************************
'*******************************************************
'CLASSE SOURCE DO ELEMENTO ITEM
'*******************************************************
Class ItemSource
'-----------------------------------------------------
'ATRIBUTOS DA CLASSE
'-----------------------------------------------------
'Obrigatórios
Private a_Url
Private a_Description
'-----------------------------------------------------
'PROPRIEDADES DA CLASSE
'-----------------------------------------------------
Public Property Get Url
Url = a_Url
End Property
Public Property Let Url(ByVal p_Url)
a_Url = p_Url
End Property
Public Property Get Description
Description = a_Description
End Property
Public Property Let Description(ByVal p_Description)
a_Description = p_Description
End Property
'-----------------------------------------------------
'MÉTODOS DE CRIAÇÃO E DESTRUIÇÃO DA CLASSE
'-----------------------------------------------------
Private Sub Class_Initialize()
End Sub
Private Sub Class_Terminate()
End Sub
End Class
'*******************************************************
</script>
Obrigado, X@nBuRzUm, fui testar o seu código mas começou a gerar alguns problemas de acesso à propriedade tagName, então pesquisando mais um pouco, vi uma propriedade que não existia (pelo que entendi) nas primeiras versões do DOMdocument, e a coloquei...
objXML.setProperty "ServerHTTPRequest", true
Então, miraculosamente, tudo passou a funcionar..
Obrigado pela ajuda...
sds
Beleza, amigo ficou feliz que deu certo...
provavelmente é o server, verifique se o http://g1.globo.com/dynamo/brasil/rss2.xml está ok e sem oscilação.