Compiles the specified XPath expression, with the System.Xml.IXmlNamespaceResolver object specified for namespace resolution, and returns an System.Xml.XPath.XPathExpression object that represents the XPath expression.
- xpath
- An XPath expression.
- nsResolver
- An object that implements the System.Xml.IXmlNamespaceResolver interface for namespace resolution.
An System.Xml.XPath.XPathExpression object.
An XPath expression is evaluated to yield one of the following result types.
If a user-defined function with an invalid number of arguments (or an unimplemented user-defined function) is specified in the XPath expression, an exception occurs only at run-time. User-defined functions are not checked at compile time and exceptions resulting from user-defined functions occur only if execution evaluates the expression.
It is not possible to compile a System.Xml.XPath.XPathExpression with a custom context in one step by passing an System.Xml.Xsl.XsltContext, which implements System.Xml.IXmlNamespaceResolver, as an argument to this method. To use a System.Xml.XPath.XPathExpression with a custom context, you must call the erload:System.Xml.XPath.XPathExpression.SetContext method after compiling the expression.