Gets the base URI for this XObject.
using System; using System.Xml.Linq; using System.Xml; class Program { static void Main(string[] args) { XElement po = XElement.Load("PurchaseOrder.xml", LoadOptions.SetBaseUri | LoadOptions.SetLineInfo); string[] splitUri = po.BaseUri.Split('/'); Console.WriteLine("BaseUri: {0}", splitUri[splitUri.Length - 1]); foreach (XElement e in po.DescendantsAndSelf()) { Console.WriteLine(e.Ancestors()); Console.WriteLine(e.Name); Console.WriteLine(((IXmlLineInfo)e).LineNumber); Console.WriteLine(((IXmlLineInfo)e).LinePosition); } } }