XML Creation
As I have already discussed, functional construction provided by the LINQ to XML API makes creating an XML tree a breeze compared to the W3C DOM API. We will now take a look at creating each of the major XML classes in the LINQ to XML API.
Because the new API is centered on elements, and that is what you will be creating the majority of the time, I cover creating elements with the XElement class first. I then cover the rest of the XML classes in alphabetical order.
Creating Elements with XElement
First, you should keep in mind that with the new API, the XElement class is the one you will use most. That said, let's take a look at instantiating an XElement object. XElement has several constructors, but I am going to examine two of ...
Get Pro LINQ: Language Integrated Query in C# 2008 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.