Create XDocument from XmlReader in CSharp

Description

The following code shows how to create XDocument from XmlReader.

Example


//from w w  w  .j  a  va 2 s  . co  m
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;

using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Reflection;
using System.Xml;
using System.Xml.Linq;

class Program {
    static void Main(string[] args) {
        XmlReader reader = XmlReader.Create("Employee.xml");
        XDocument xml = XDocument.Load(reader);
        Console.WriteLine(xml);

    }
}




















Home »
  C# Tutorial »
    XML »




Load Parse
Document
Element
Attribute
Namespace
Query
Save
Schema
Style