Load Xml document and print attributes : XML File Read « XML « VB.Net






Load Xml document and print attributes

  
Imports System
Imports System.Xml
Imports System.Xml.Schema
Imports System.IO
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Collections
Imports System.Data
Imports System.Windows.Forms


Public Class MainClass
    
    Shared Sub Main()
        Dim Doc As New XmlDocument()
        Dim TempNode As XmlElement
        Dim x As Integer
                
        Doc.Load("OutDocument.xml")
        Dim DocRoot As XmlElement = Doc.CreateElement("Orders")
        For x = 0 To DocRoot.ChildNodes.Count - 1
            TempNode = CType(DocRoot.ChildNodes(x), XmlElement)
            Console.WriteLine("Order Quantity: {0}", _
                 TempNode.GetAttribute("Quantity"))
        Next
    End Sub

End Class



           
         
    
  








Related examples in the same category

1.Use XML Reader to display XML tag, Node type and attributesUse XML Reader to display XML tag, Node type and attributes
2.XmlTextReader: XmlNodeType Element, Text and EndElement XmlTextReader: XmlNodeType Element, Text and EndElement
3.Using XmlReaderSettings and XmlWriterSettings
4.Reading an XML file example
5.Is starting element
6.Loads the XML document from the specified TextReader.
7.Loads the XML document from the specified string.
8.LoadOptions.PreserveWhitespace