I am creating a custom (private, non-commercial) utility to parse RSS feeds. Since it's been a few years since I've had a need to do this, I referred to an example at CodeDisplay.com
I'm providing the code in VB.NET, however - I'm sure C# programmers can recognize the concepts also.
In short, the code in question is as follows. My first iteration used a Reuters feed.
Dim MyRssRequest As WebRequest = WebRequest.Create("http://feeds.reuters.com/reuters/topNews")
Dim MyRssResponse As WebResponse = MyRssRequest.GetResponse()
Dim MyRssStream As Stream = MyRssResponse.GetResponseStream()
Dim MyRssDocument As XmlDocument = New XmlDocument()
MyRssDocument.Load(MyRssStream)
Dim MyRssList As XmlNodeList = MyRssDocument.SelectNodes("rss/channel/item")
Dim sTitle As String = ""
Dim sLink As String = ""
Dim sDescription As String = ""
'Iterate/Loop through RSS Feed items
For i As Integer = 0 To MyRssList.Count - 1
...
This code works as desired. However - if I change the respective lines to the following (to another news source):
Dim MyRssRequest As WebRequest = WebRequest.Create("http://api.breakingnews.com/api/v1/item/?format=rss")
...and...
Dim MyRssList As XmlNodeList = MyRssDocument.SelectNodes("feed/entry")
...this code can not seem to find any "entry" items. I'm using the tools at http://xmlgrid.net/ to sanity check my understanding of the hierarchy. This tool seems to report that both XML structures are well formed.
I am curious if the .NET XML (System.xml) is sensitive on "End of Line" characters, but I find this doubtful.
I feel this is something simple that I am overlooking.
UPDATE:
I am able to step through the items by using
Dim MyRssList As XmlNodeList = MyRssDocument.ChildNodes(1).ChildNodes
I must be missing something on my understanding of this document's XPath. I would like to be able to use the .SelectNodes method (function) using the XPath.