Basic Queries (LINQ to XML)
This section provides examples of basic LINQ to XML queries.
In This Section
Topic |
Description |
---|---|
Shows how to find a particular element that has an attribute that has a specific value. |
|
Shows how to find a particular element that has a child element that has a specific value. |
|
Explains the differences between writing queries on an XML tree that is rooted in XElement and writing queries on an XML tree that is rooted in XDocument. |
|
Shows how to find all the descendants of an element that have a specific name. This example uses the Descendants axis. |
|
How to: Find a Single Descendant Using the Descendants Method |
Shows how to use the Descendants axis method to find a single uniquely named element. |
Shows how to write a query with a more complex filter. |
|
Shows how to find nodes in an irregularly shaped tree. |
|
Shows how to find all nodes that are in a specific namespace. |
|
Shows how to write a query that sorts its results. |
|
Shows how to sort on multiple keys. |
|
Shows how to use the Let clause to calculate intermediate values in a LINQ to XML query. |
|
Shows how to select elements based on other elements in the tree. |
|
Shows the appropriate fix when debugging queries on XML that is in a default namespace. |