Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Dim BookingDatabase As XDocument = XDocument.Load("https://itunes.apple.com/us/rss/topsongs/limit=10/xml")

Dim feeds = From feed In BookingDatabase.Descendants("entry")
       Select mytitle = feed.Element("title").Value,
           myrights = feed.Element("rights").Value

      
For Each feed In feeds
   Dim myLabel As New Label
   myLabel.Text = feed.mytitle.First.ToString & " - " & feed.myrights.First.ToString            
    PlaceHolder1.Controls.Add(myLabel)

Next

I can't see what I have done wrong - but no results
Ideas?
Posted
Updated 3-Aug-15 9:38am
v2

1 solution

The XML document you've loaded has a default namespace of http://www.w3.org/2005/Atom - you need to include that namespace in the element names:
VB
Dim atom As XNamespace = "http://www.w3.org/2005/Atom"
Dim BookingDatabase As XDocument = XDocument.Load("https://itunes.apple.com/us/rss/topsongs/limit=10/xml")

Dim feeds = From feed In BookingDatabase.Descendants(atom + "entry")
    Select mytitle = feed.Element(atom + "title").Value,
    myrights = feed.Element(atom + "rights").Value
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900