Parsing an XML String into an Element : XElement : XML LINQ C# Source Code


Custom Search

C# Source Code » XML LINQ » XElement »

 

Parsing an XML String into an Element








    
 

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Linq;
public class MainClass {
    public static void Main() {

        string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Books>" +
      "<Book type=\"Author\" experience=\"first-time\" language=" +
      "\"English\"><FirstName>J</FirstName><LastName>R</LastName>" +
      "</Book></Books>";

        XElement xElement = XElement.Parse(xml); 
        Console.WriteLine(xElement);

    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo XML LINQ
» XElement