Using LINQ to XML (and how to build a custom RSS Feed Reader with it)
page 8 of 9
by Scott Guthrie
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 38989/ 73


LINQ to XML provides a really powerful way to efficiently query, filter, and shape/transform XML data.  You can use it both against local XML content, as well as remote XML feeds.  You can use it to easily transform XML data into .NET objects and collections that you can further manipulate and transfer across your application.

LINQ to XML uses the same core LINQ query syntax and concepts that LINQ to SQL, LINQ to Objects, LINQ to SharePoint, LINQ to Amazon, LINQ to NHibernate, etc. use when querying data. You can learn more about the LINQ query syntax and the supporting language features being added to VB and C# to support it from these previous blog posts of mine:

Automatic Properties, Object Initializer and Collection Initializers

Extension Methods

Lambda Expressions

Query Syntax

Anonymous Types

You might also find these blog posts of mine useful to learn more about LINQ to SQL:

Part 1: Introduction to LINQ to SQL

Part 2: Defining our Data Model Classes

Part 3: Querying our Database

Part 4: Updating our Database

Part 5: Binding UI using the ASP:LinqDataSource Control

In a future blog post I'll return to LINQ to XML and demonstrate how it can be used not just to query XML, but also to really cleanly generate XML output from a .NET data structure. 

Hope this helps,


View Entire Article

User Comments

Title: Using LINQ Sub-Queries within a LINQ to XML Query Expression   
Name: Ken Jinks
Date: 2009-07-10 1:27:32 PM
How would you incorporate a where clause into the subquery such that you only retrieve those items with a particular TAG value?

Title: How to integrate with XLINQ in eixsting applications   
Name: Senthil
Date: 2008-12-17 12:21:13 AM
How to integrate with XLINQ in eixsting applications

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2021  |  Page Processed at 2021-11-29 1:02:39 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search