--- title: document.createExpression slug: Web/API/Document/createExpression translation_of: Web/API/Document/createExpression ---
{{ ApiRef() }}
该方法将编译生成一个 XPathExpression
,可以用来多次的执行.
xpathExpr = document.createExpression(xpathText, namespaceURLMapper);
xpathText
(将要编译的Xpath表达式)namespaceURLMapper
(将一个命名空间前缀映射到一个命名空间URL上 (如果不需要,可以为null
)){{ Fx_minversion_note("3") }}
{{ languages( {"en": "en/DOM/document.createExpression" } ) }}