PushScope Method
Collapse the table of content
Expand the table of content

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.

Namespace:  System.Xml
Assembly:  System.Xml (in System.Xml.dll)

'Declaration
Public Overridable Sub PushScope

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()


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2017 Microsoft