Hello,
I have some code which simply reads a RSS with the
XmlTextReader and XmlDocument. Unfortunaly I get the error:
Object reference not set to an instance of an object.
Here is my simple code:
private function CheckRSS(byval strRSS as string)
Dim reader as new XmlTextReader(strRSS)
Dim xmlDoc as XmlDocument
Try
xmlDoc.Load(reader)
Catch ex As Exception
Response.Write("ERR in Rss File:" & strRSS
& "<br>")
Response.Write("Err: RSS File:" & ex.Message
& "<br>")
Exit Function
End Try
' load only the item nodes
Dim nodes As XmlNodeList = xmlDoc.SelectNodes
("/rss/channel/item")
For Each node As XmlNode In nodes
Try
Dim strPostTitle as string = node
("title").InnerXml
Dim strPost as string = node
("description").InnerXml
Dim strPostURL as string = node
("link").InnerXml
Dim strPostDate as string = node
("pubDate").InnerXml
response.write(strPostTitle & "<br>")
Catch ex As Exception
Response.Write("ERR in loading nodes: " &
ex.Message() & "<br>")
Exit Function
End Try
Next
end function
Can anybody tell me why I get this error?
Thanks