Export (0) Print
Expand All

XmlNamespaceManager.PopScope Method

Pops a namespace scope off the stack.

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

public virtual bool PopScope()

Return Value

Type: System.Boolean
true if there are namespace scopes left on the stack; false if there are no more namespaces to pop.

When you call this method, all namespaces which were added to XmlNamespaceManager (by calling AddNamespace) since the last call to PopScope are removed.


                // Create the XmlNamespaceManager.
                NameTable nt = new NameTable();
                XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);

                StringBuilder output = new StringBuilder();

                // Add prefix/namespace pairs to the XmlNamespaceManager.
                nsmgr.AddNamespace("", "www.wideworldimporters.com"); //Adds a default namespace.
                nsmgr.AddNamespace("europe", "www.wideworldimporters.com/europe");
                nsmgr.PushScope();  //Pushes a namespace scope on the stack.
                nsmgr.AddNamespace("", "www.lucernepublishing.com"); //Adds another default namespace.
                nsmgr.AddNamespace("partners", "www.lucernepublishing.com/partners");

                output.AppendLine("Show all the prefix/namespace pairs in the XmlNamespaceManager...");

                do
                {
                    foreach (String prefix in nsmgr)
                    {
                        output.AppendLine("Prefix=" + prefix + " Namespace=" + nsmgr.LookupNamespace(prefix));
                    }
                }
                while (nsmgr.PopScope());

                OutputTextBlock.Text = output.ToString();



Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft