Mega Code Archive

 
Categories / VB.Net / XML
 

Returns the XmlAttribute with the specified name

Imports System Imports System.IO Imports System.Xml public class Sample   public shared sub Main()     Dim doc as XmlDocument = new XmlDocument()     doc.LoadXml("<book genre='Computer' ISBN='1-111111-57-5'>" & _                 "<title>C#</title>" & _                 "</book>")           Dim root as XmlElement = doc.DocumentElement     if (root.HasAttribute("genre"))      Dim attr as XmlAttribute = root.GetAttributeNode("genre")      Console.WriteLine(attr.Value)     end if     Console.WriteLine(doc.InnerXml)   end sub end class