Gets the XmlElement with the specified ID. : XmlElement « XML « VB.Net






Gets the XmlElement with the specified ID.

 

Option Explicit
Option Strict

Imports System
Imports System.Xml

Public Class Sample

    Public Shared Sub Main()
        Dim doc As New XmlDocument()
        doc.Load("ids.xml")

        Dim elem As XmlElement = doc.GetElementById("A111")
        Console.WriteLine(elem.OuterXml)

        elem = doc.GetElementById("A222")
        Console.WriteLine(elem.OuterXml)
    End Sub 'Main 
End Class 'Sample

   
  








Related examples in the same category

1.Gets the root XmlElement for the document.