.NET Essentials: LINQ for XML

.NET Essentials: LINQ for XML

English | MP4 | AVC 1280×720 | AAC 48KHz 2ch | 1h 32m | 295 MB

The first explanation you typically hear about Microsoft LINQ is that it provides an in-language query tool to manipulate the contents of arrays and lists. Explore LINQ further and you’ll find it works with other popular data sources like XML files. In this course, instructor Walt Ritscher shows you how LINQ to XML uses LINQ extension methods to read, create, search, and manipulate XML in a simplified way. Walt walks you through LINQPad, the lightweight, powerful code editor and code runner that is used in this course, then explains how to load XML into different LINQ classes. He covers how you can get different elements and attributes from XML and some of the ways you can work with elements and attributes, after getting them. Walt describes a variety of query operators that you can use. He concludes with a discussion on how you can create and edit XML structure with LINQ.

Table of Contents

Introduction
1 Query and transform your XML data with LINQ
2 What you should know
3 How to access the sample code on GitHub
4 Why this course uses LINQPad
5 Install LINQPad

Load XML into LINQ Classes
6 Understand LINQ for XML
7 The XML data files for this course
8 Load data from an XML file
9 Quick look at the XElement class
10 Parse XML in an XML string
11 Save the XML document

Work with Elements and Attributes
12 Get an element from XML
13 Get an attribute from XML
14 Get nodes when using schema namespace
15 Get single or multiple elements
16 Get child element
17 Get child elements
18 Use Descendants() to recurse child elements
19 Get attributes
20 Read element and attribute values
21 Change element and attribute values
22 Use SetElementValue to add, remove, and modify child elements
23 Use SetValue to set with non-string data

Query Operators
24 Use Query syntax to work with elements
25 Attribute query
26 Select data into a new anonymous type
27 Where clause on attribute value
28 Where clause with compare
29 Aggregate queries
30 Choose output order with OrderBy
31 Query for empty elements and blank values
32 Group by
33 Challenge Create custom string output
34 Solution Create custom string output
35 Challenge Filter results to show elements with no content
36 Solution Filter results to show elements with no content
37 Challenge Filter results to show invalid values
38 Solution Filter results to show invalid values

Create and Edit XML Structure
39 Use the DumpFormatted extension method
40 XDocument compared to XElement
41 Create XML structure
42 Rename elements and attributes
43 Replace elements and attributes
44 Remove element
45 Add parent element and move elements
46 Challenge Move attributes and elements
47 Solution Move attributes and elements

Conclusion
48 Next steps

Homepage