|TABLE OF CONTENTS|
LINQ and Visual Studio 2008's new language features
LINQ and Web applications
LINQ to Objects
LINQ to XML
LINQ to SQL
LINQ to DataSet
LINQ to Entities
Third-party LINQ Implementations
VISIT OUR OTHER LEARNING GUIDES
|LINQ to XML|
This section of the LINQ Learning Guide focuses on the implementation called LINQ to XML, which is specifically targeted to XML data. Here we provide an introduction to LINQ to XML and provide some resources that walk programmers through some specific tasks. From here, check out the next section of the LINQ Learning Guide, which focuses on the LINQ to SQL flavor.
LINQ to XML five-minute
overview (Hooked on LINQ)
Here you'll see how to load an XML file and then write a query over it.
LINQ to XML overview
This page provides the customary introduction to LINQ to XML. "It is like the Document Object Model (DOM) in that it brings the XML document into memory," Microsoft states, adding that it also differs from DOM because "it provides a new object model that is lighter weight and easier to work with, and that takes advantage of language improvements" in C# and Visual Basic.
LINQ to XML programming
Here you'll find a series of articles on various tasks associated with LINQ to XML -- XML namespaces, XML trees and "mitigating security exposure." (Code is in C#.)
.NET Language-Integrated Query
for XML data (Microsoft)
This lengthy tutorial covers the ins and outs of XML programming, LINQ to XML queries and using XML with other data models such as SQL Server.
demystified (Daniel Moth)
System.Xml.Linq is the .NET Framework 3.5 assembly for working with LINQ to XAML. As this blogger indicates, "[E]ffectively this is a standalone new XML API. You can use it without ever going anywhere near the LINQ syntax." A diagram helps illustrate the namespaces and types within the assembly.
Podcast: Scott Hanselman and Carl
Franklin talk LINQ to XML (Hanselminutes)
Here you'll hear some thoughts on XDocuments, XElements classes that link System.Xml and System.Xml.Linq.
LINQ to XML samples
These downloadable code samples come in C# and in Visual Basic.
*** The resources that follow address some specific tasks that a C# or Visual Basic programmer may want to accomplish using LINQ to XML.
LINQ to XML to build a custom RSS feed reader (Scott Guthrie)
The title of this article pretty much says it all -- Guthrie introduces readers to LINQ to XML, offers a refresher course on anonymous types and demonstrates how to use LINQ to XML to take the individual items within an RSS feed, treat them as .NET objects and bind them to, say, an ASP.NET GridView.
import, export Excel data with LINQ to XML (Beth Massi)
This article demonstrates how to get an Excel 2003 file into XML format and then import it using LINQ to XML. (The author chose Excel 2003 to prove that it'll work with the older version as well as with Excel 2007.)
to XSD: Typed XML programming with LINQ (Fabrice Marguerie)
LINQ to XSD allows typed XML programming atop LINQ to XML. Running it requires an XML Schema, which "generate[s] an object model that can then be used to manipulate XML data through LINQ, while enforcing types and the various validation constraints specified in the XML schema."
Parsing WordML using
LINQ to XML (Eric White)
WordML is an XML file format for Microsoft Word documents. Since WordML files aren't terribly pretty, this blogger wanted to take his files apart using LINQ to XML (known as XLinq when this blog entry was written). It's an interesting take on what LINQ can accomplish.
XML in ASP.NET: Ajax-enabled XML document filtering (Mustafa Basgun)
Having created an Ajax- enabled Web application with a drop-down list bound to an XML document, this blogger decided to share his brief lesson with the world.
XML documents with LINQ to XML and Creating
and modifying XML documents (Blocks4.NET Team Blog)
These articles provide a few LINQ to XML examples -- searching for elements in an XML document, using lambda expressions (remember those?) and creating XML documents from scratch.
with LINQ to XML (Steven Eichert)
It's not unusual for programmers to take raw XML and transform it into another XML format or into a set of objects. Here one of the authors of Manning's LINQ in Action explains how such transformations can be done with LINQ to XML.
*** Go on to the next section of the LINQ Learning Guide: LINQ to SQL
This was first published in February 2008