Name
Document.createExpression( ): create an XPath expression for later evaluation — Firefox 1.0, Safari 2.01, Opera 9:
Synopsis
XPathExpression createExpression(StringxpathText, FunctionnamespaceURLMapper) throws XPathException
Arguments
-
xpathText The string representing the XPath expression to compile.
-
namespaceURLMapper A function that will map from a namespace prefix to a full namespace URL, or
nullif no such mapping is required.
Returns
An XPathExpression object.
Throws
This method throws an exception if the
xpathText contains a syntax error or if
it uses a namespace prefix that cannot be resolved by
namespaceURLMapper.
Description
This method takes a string representation of an XPath
expression and converts it to a compiled representation, an XPathExpression. In addition to the
expression, this method takes a function of the form function(prefix) that resolves a namespace
prefix string and returns it as a full namespace URL string.
Internet Explorer does not support this API. See Node.selectNodes( ) for an IE-specific
alternative.
See Also
Document.evaluate( ),
Node.selectNodes( ), XPathExpression, XPathResult
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access