XML DOM createExpression() method
Definition and usage
The createExpression() method creates an XPath expression for later calculation.
Syntax:
createExpression(xpathText,namespaceURLMapper)
Parameter | Description |
---|---|
xpathText | A string representing the XPath expression to be compiled. |
namespaceURLMapper | a function that maps a namespace prefix to a full namespace URL. If such a mapping is not needed, it is null. |
return value
throw
If xpathText Contains a syntax error or it uses namespaceURLMapper An unresolvable namespace prefix, this method will throw an exception.
Description
This method accepts a string representing an XPath expression and converts it into a compiled expression, that is, an XPathExpression. In addition to this expression, the method also accepts a function of the form function(prefix), which parses a namespace prefix string and returns a full namespace URL string.
IE does not support this API. See Node.selectNodes() Learn about a specific alternative method for IE.