Parse Load xml from hard coded string : XElement « XML LINQ « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Text;


    class Program
    {
        static void Main(string[] args)
        {
            XElement xdoc = XElement.Parse(@"
                    <customers>
                      <customer ID=""A"">
                        <order Item=""Widget"" Price=""100"" />
                        <order Item=""Tire"" Price=""200"" />
                      </customer>
                    </customers>
                    ");
            Console.WriteLine(xdoc);
        }
    }








31.2.XElement
31.2.1.Parse Load xml from hard coded string
31.2.2.XML Fragments
31.2.3.Get Descendants for a node
31.2.4.Deal with White Spaces
31.2.5.Load xml from string, text file
31.2.6.Remove an element