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() {
XDocument xDocument = XDocument.Load("book.xml",LoadOptions.SetBaseUri | LoadOptions.SetLineInfo);
Console.WriteLine(xDocument);
XElement firstName = xDocument.Descendants("FirstName").First();
Console.WriteLine("FirstName Line:{0} Position:{1}",((IXmlLineInfo)firstName).LineNumber,((IXmlLineInfo)firstName).LinePosition);
Console.WriteLine("FirstName Base URI:{0}", firstName.BaseUri);
}
}
|