Visual Studio Toolbox: Using LINQ to XML to Query Data on the Web
- Posted: Sep 28, 2011 at 12:41 PM
- 51,423 Views
- 12 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
These days, Web sites are providing access to a large amount of data, everything from RSS feeds to pictures to movie titles and more. Often, all you need to do in an application is send an HTTP request to a Web site. The Web site sends the data back via XML, and the easiest way to work with that data is to use LINQ queries. In this episode, Robert shows you how to use LINQ to XML to make sense of the XML data a Web site sends you. He gives examples of working with an RSS feed, retrieving images from Flickr, querying for wineries and wines using Wine.com, and returning movies from NetFlix. You'll see basic queries, see how to retrieve data from elements and attributes, and see how to work with namespaces.
Check out Robert's blog for all the code he used in this episode.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
Waiting for the next episode you announced (using Linq to XML to write XML instead of querying).
Great job!
Good show but lets not waste time with VB examples.
Many answered about what we want to see but you do not listen to what we say.
Lets try one more time:
We want to see C++11 with visual studio using GCC and clang.
Do you refuse to listen because the compiler we want to use is GCC which is not a microsoft product ?
Great episode Robert. As JSON is becoming more popular than XML due to it's smaller size, what about a show on LINQ to JSON? I see there are some frameworks out there that can do this. What about a show on this?
this man looks like justin huffman...
@peter: I hope that is a complement!
Great examples
I wish I had this months ago.
Just watched this on the bus ride into work. Excellent!
Great show. I would love to see more feature deep dive episodes. Thanks for putting this together.
I like this style of deep dive, but I have one remark.
Never use the query operator Count() to check for the presence of items in a sequence! You should generally use Any(), as Count() needs to read the complete sequence. (In your example prefer !posts.Any() over posts.Count() == 0; because you are materializing the sequence twice, in Count() and on iterating the sequence.)
Remove this comment
Remove this thread
close