' 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 E
    Public Class Program
        Public Shared Sub Main(args As String())
            Dim xmlstr As String = "<a xmlns:df='http://df2'><b xmlns='http://df1'><x><![CDATA[ABC<x></x>]]></x></b><c xmlns='http://df2'><x><![CDATA[DEF<x></x>]]></x></c><c xmlns='http://df3'><x><![CDATA[GHI<x></x>]]></x></c><df:c><df:x><![CDATA[JKL<x></x>]]></df:x></df:c></a>"
            Dim doc As New XmlDocument()
            doc.LoadXml(xmlstr)
            Dim nsm As New XmlNamespaceManager(doc.NameTable)
            nsm.AddNamespace("df1", "http://df1")
            nsm.AddNamespace("df2", "http://df2")
            nsm.AddNamespace("df3", "http://df3")
            For Each n As XmlNode In doc.SelectNodes("/a/df2:c/df2:x/text()", nsm)
                Console.WriteLine(n.Value)
            Next
            Console.ReadKey()
        End Sub
    End Class
End Namespace
