Imports System
Imports System.IO
Imports System.Xml
public class Sample
public shared sub Main()
Dim xmlFrag as string =" " & _
"C#" & _
"Computer" & _
""
Dim nt as NameTable = new NameTable()
Dim nsmgr as XmlNamespaceManager = new XmlNamespaceManager(nt)
nsmgr.AddNamespace("bk", "urn:sample")
Dim context as XmlParserContext = new XmlParserContext(nothing, nsmgr, nothing, XmlSpace.None)
Dim reader as XmlTextReader = new XmlTextReader(xmlFrag, XmlNodeType.Element, context)
while (reader.Read())
if (reader.IsStartElement())
if (reader.Prefix=String.Empty)
Console.WriteLine("<{0}>", reader.LocalName)
else
Console.Write("<{0}:{1}>", reader.Prefix, reader.LocalName)
Console.WriteLine(" The namespace URI is " + reader.NamespaceURI)
end if
end if
end while
reader.Close()
end sub
end class