' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
﻿Imports System
Imports System.Xml

Namespace DF2
    Public Class Program
        Public Shared Sub Main(args As String())
            Dim xml As String = "<all>" & vbCrLf & _
                "    <one>" & vbCrLf & _
                "        <a id=""1""/>" & vbCrLf & _
                "        <b>A</b>" & vbCrLf & _
                "    </one>" & vbCrLf & _
                "    <one>" & vbCrLf & _
                "        <a id=""2""/>" & vbCrLf & _
                "        <b>BB</b>" & vbCrLf & _
                "    </one>" & vbCrLf & _
                "    <one>" & vbCrLf & _
                "        <a id=""3""/>" & vbCrLf & _
                "        <b>CCC</b>" & vbCrLf & _
                "    </one>" & vbCrLf & _
                "</all>"
            Console.WriteLine(xml)
            Dim doc As New XmlDocument()
            doc.LoadXml(xml)
            For Each n As XmlNode In doc.SelectNodes("/all/one")
                Console.WriteLine(n.SelectSingleNode("a/@id").Value & " " & n.SelectSingleNode("b/text()").Value)
            Next
        End Sub
    End Class
End Namespace
