XmlNamespaceManager.LookupNamespace Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets the namespace URI for the specified prefix.
Assembly: System.Xml (in System.Xml.dll)
Parameters
- prefix
- Type: System.String
The prefix whose namespace URI you want to resolve. To match the default namespace, pass String.Empty.
Return Value
Type: System.StringReturns the namespace URI for prefix or Nothing if there is no mapped namespace. The returned string is atomized.
For more information on atomized strings, see XmlNameTable.
Implements
IXmlNamespaceResolver.LookupNamespace(String)Dim output As New StringBuilder() Dim xmlFrag As String = _ "<root>" & _ "<data>" & _ "<items>" & _ "<item id='1'>" & _ "</item>" & _ "</items>" & _ "</data>" & _ "</root>" Using reader As XmlReader = XmlReader.Create(New StringReader(xmlFrag)) Dim nsmanager As New XmlNamespaceManager(reader.NameTable) nsmanager.AddNamespace("msbooks", "www.microsoft.com/books") nsmanager.PushScope() nsmanager.AddNamespace("msstore", "www.microsoft.com/store") Dim prefix As String For Each prefix In nsmanager output.AppendLine(("Prefix" + prefix + _ " Namespace=" + nsmanager.LookupNamespace(prefix))) Next prefix End Using OutputTextBlock.Text = output.ToString()
Show: