Mono Class Library: System.Xml.XPath.XPathExpression Overview | Members

System.Xml.XPath.XPathExpression.SetContext Method

Sets an System.Xml.XmlNamespaceManager instance as an XPath evaluation context, especially to provide namespace mappings in XPath.

public abstract void SetContext (System.Xml.XmlNamespaceManager nsManager)

Parameters

nsManager
an System.Xml.XmlNamespaceManager to be used as XPath evaluation context.

Remarks

This method sets an XmlNamespaceManager as XPath (and thus XSLT) evaluation context. This class might provide other XSLT context information such as current whitespace preservation value and current variable bindings. (System.Xml.Xsl.XsltContext is derived from XmlNamespaceManager.)

To evaluate compiled XPath expression that was originally just a string that might contain arbitrary namespace prefixes, this class requires a "namespace context" before evaluating prefixed XPath expression. The argument XmlNamespaceManager has a mapping from prefix (that might be used in XPath expression string) and namespace URI. Without this information, XPath evaluation might result in an error (since it cannot determine the namespace URI for the prefix).

Requirements

Namespace: System.Xml.XPath
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0