System.Xml.XPath.XPathExpression.SetContext Method

When overridden in a derived class, specifies the System.Xml.IXmlNamespaceResolver object to use for namespace resolution.

Syntax

public abstract void SetContext (System.Xml.IXmlNamespaceResolver nsResolver)

Parameters

nsResolver
An object that implements the System.Xml.IXmlNamespaceResolver interface to use for namespace resolution.

Remarks

Namespace resolution is supported using classes that implement the System.Xml.IXmlNamespaceResolver interface, such as the System.Xml.XmlNamespaceManager class. The System.Xml.XmlNamespaceManager stores prefix and namespace Uniform Resource Identifier (URI) mappings. If the System.Xml.XPath.XPathExpression requires namespace resolution, the prefix and namespace URI pair must be added to an object, such as the System.Xml.XmlNamespaceManager class, which implements the System.Xml.IXmlNamespaceResolver interface, and the XPathExpression.SetContext(System.Xml.IXmlNamespaceResolver) method must be called to specify the System.Xml.IXmlNamespaceResolver interface object to use for namespace resolution.

The following are important notes to consider when using the XPathExpression.SetContext(System.Xml.IXmlNamespaceResolver) method.

Requirements

Namespace: System.Xml.XPath
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0