Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
RemoveNamespace Method

XmlNamespaceManager.RemoveNamespace Method

Removes the given namespace for the given prefix.

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

public virtual void RemoveNamespace(
	string prefix,
	string uri
)

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.

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


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:
© 2015 Microsoft