XObject.BaseUri Property gets the base URI for this XObject. : XObject « XML LINQ « VB.Net






XObject.BaseUri Property gets the base URI for this XObject.

 

Imports System
Imports System.Xml
Imports System.Xml.Schema

Class MainClass

    Shared Sub Main()

        Dim po As XElement = XElement.Load("Order.xml", LoadOptions.SetBaseUri Or LoadOptions.SetLineInfo)
        Dim splitUri() As String = po.BaseUri.Split("/"c)
        Console.WriteLine("BaseUri: {0}", splitUri(splitUri.Length - 1))

        For Each e As XElement In po.DescendantsAndSelf()
            Console.WriteLine("{0}{1}{2}", _
                ("".PadRight(e.Ancestors().Count() * 2) & e.Name.ToString).PadRight(20), _
                DirectCast(e, IXmlLineInfo).LineNumber.ToString().PadRight(5), _
                DirectCast(e, IXmlLineInfo).LinePosition)
        Next
    End Sub

End Class

   
  








Related examples in the same category

1.XObject.AddAnnotation adds an object to the annotation list of this XObject.
2.XObject.Annotation gets the first annotation object of the specified type from this XObject.
3.XObject.Annotation(T) gets the first annotation object of the specified type from this XObject.
4.XObject.Annotations gets a collection of annotations of the specified type for this XObject.
5.XObject.Annotations(T) gets a collection of annotations of the specified type for this XObject.
6.XObject.Changed Event raised when this XObject or any of its descendants have changed.
7.XObject.Changing Event
8.XObject.RemoveAnnotations (Type) removes the annotations of the specified type from this XObject.
9.XObject.RemoveAnnotations(T) removes the annotations of the specified type from this XObject.