Introduction
Query and transform your XML data with LINQ
()
What you should know
()
How to access the sample code on GitHub
()
Why this course uses LINQPad
()
Install LINQPad
()
1. Load XML into LINQ Classes
Understand LINQ for XML
()
The XML data files for this course
()
Load data from an XML file
()
Quick look at the XElement class
()
Parse XML in an XML string
()
Save the XML document
()
2. Work with Elements and Attributes
Get an element from XML
()
Get an attribute from XML
()
Get nodes when using schema namespace
()
Get single or multiple elements
()
Get child element
()
Get child elements
()
Use Descendants() to recurse child elements
()
Get attributes
()
Read element and attribute values
()
Change element and attribute values
()
Use SetElementValue to add, remove, and modify child elements
()
Use SetValue to set with non-string data
()
3. Query Operators
Use Query syntax to work with elements
()
Attribute query
()
Select data into a new anonymous type
()
Where clause on attribute value
()
Where clause with compare
()
Aggregate queries
()
Choose output order with OrderBy
()
Query for empty elements and blank values
()
Group by
()
Challenge: Create custom string output
()
Solution: Create custom string output
()
Challenge: Filter results to show elements with no content
()
Solution: Filter results to show elements with no content
()
Challenge: Filter results to show invalid values
()
Solution: Filter results to show invalid values
()
4. Create and Edit XML Structure
Use the DumpFormatted extension method
()
XDocument compared to XElement
()
Create XML structure
()
Rename elements and attributes
()
Replace elements and attributes
()
Remove element
()
Add parent element and move elements
()
Challenge: Move attributes and elements
()
Solution: Move attributes and elements
()