Document.CreateExpression

Document.CreateExpression method

Creates a parsed XPath expression with resolved packages. This is useful when an expression will be reused in an application since it makes it possible to compile the expression String into a more efficient internal form and preresolve all package prefixes which occur within the expression.

public IXPathExpression CreateExpression(String expression, IXPathNSResolver resolver)
ParameterTypeDescription
expressionStringThe XPath expression String to be parsed.
resolverIXPathNSResolverThe resolver permits translation of all prefixes, including the xml package prefix, within the XPath expression into appropriate package URIs. If this is specified as null, any package prefix within the expression will result in DOMException being thrown with the code NAMESPACE_ERR.

Return Value

The compiled form of the XPath expression.

Exceptions

exceptioncondition
dOMExceptionINVALID_EXPRESSION_ERR: Raised if the expression is not legal according to the rules of the IXPathEvaluator.
dOMExceptionNAMESPACE_ERR: Raised if the expression contains package prefixes which cannot be resolved by the specified IXPathNSResolver.

See Also