LINQ to XML Axes
After you have created an XML tree or loaded an XML document into an XML tree, you can query it to find elements and attributes and retrieve their values.
Before you can write any queries, you must understand the LINQ to XML axes. There are two kinds of axis methods: First, there are the methods that you call on a single XElement object, XDocument object, or XNode object. These methods operate on a single object and return a collection of XElement, XAttribute, or XNode objects. Second, there are extension methods that operate on collections and return collections. The extension methods enumerate the source collection, call the appropriate axis method on each item in the collection, and concatenate the results.
In This Section
Topic |
Description |
---|---|
Defines axes, and explains how they are used in the context of LINQ to XML queries. |
|
Introduces the Elements method. This method retrieves a collection of the child elements of an element. |
|
Shows how to get the values of elements. |
|
Shows how to filter on element names when using axes. |
|
Shows how to chain calls to axes methods. |
|
Shows how to retrieve a single child element of an element, given the tag name of the child element. |
|
Introduces the Attributes method. This method retrieves the attributes of an element. |
|
Shows how to retrieve a single attribute of an element, given the attribute name. |
|
Shows how to get the values of attributes. |
|
Shows how to retrieve the shallow value of an element. |
|
Summarizes the Visual Basic integrated axes. |
See Also
Concepts
Programming Guide (LINQ to XML)