views:

36

answers:

1

I feel like an idiot for asking this question again, as I know it's been asked several times. I cannot for the life of me get this code working even with the answers that have already been provided, so I'm hoping that by offering my current code, someone can help me determine where I'm going wrong:

            Dim RSSReader As New Xml.XmlTextReader("http://stackoverflow.com/feeds")
            Dim RSSDoc As New Xml.XmlDocument()

            Dim NSMgr As New Xml.XmlNamespaceManager(RSSDoc.NameTable)
            NSMgr.AddNamespace("atom", "http://www.w3.org/2005/Atom")
            RSSDoc.Load(RSSReader.GetRemainder())
            RSSReader.Close()

            For Each Node As Xml.XmlNode In RSSDoc.SelectNodes("atom:entry", NSMgr)
                AddAtomMessage(Account, Node)
            Next

Based on the above code the "AddAtomMessage" method never gets executed as no nodes are returns by "SelectNodes" on the For/Each line.

+1  A: 

Your XPath is wrong. You want

//atom:entry

or (more specific is better)

/atom:feed/atom:entry
Tomalak
Thanks a bunch. I thought I didn't need the initial forward slash if I wanted to search anywhere in the XML.
Purple Ant