XmlNamespaceManager.PushScope Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Pushes a namespace scope onto the stack.
Assembly: System.Xml (in System.Xml.dll)
After a call to this method, all namespaces, which are added to XmlNamespaceManager (by calling AddNamespace), belong to the pushed namespace scope.
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: