XmlNamespaceManager.RemoveNamespace Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Removes the given namespace for the given prefix.
Assembly: System.Xml (in System.Xml.dll)
Parameters
- prefix
- Type: System.String
The prefix for the namespace
- uri
- Type: System.String
The namespace to remove for the given prefix. The namespace removed is from the current namespace scope. Namespaces outside the current scope are ignored.
| Exception | Condition |
|---|---|
| ArgumentNullException | The value of prefix or uri is null. |
StringBuilder output = new StringBuilder(); // Create the XmlNamespaceManager. NameTable nt = new NameTable(); XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt); // Add prefix/namespace pairs to the XmlNamespaceManager. nsmgr.AddNamespace("", "www.wideworldimporters.com"); //Adds a default namespace. nsmgr.AddNamespace("europe", "www.wideworldimporters.com/europe"); String prefix = nsmgr.LookupPrefix("www.wideworldimporters.com/europe"); output.AppendLine(" Before removing prefix: " + prefix); nsmgr.RemoveNamespace(prefix, "www.wideworldimporters.com/europe"); output.Append(" Before removing prefix: " + nsmgr.LookupPrefix("www.wideworldimporters.com/europe")); OutputTextBlock.Text = output.ToString();
Show: