Mah*_*oni 6 xpath google-chrome namespaces google-chrome-devtools
我在Chrome中打开了一个XML文档,我想测试一些XPath表达式.XML文档涉及不同的命名空间.如何定义前缀URI?
为了测试Chrome中的XPath表达式,我$x("...")
到目前为止已经使用过.
摘自developer.mozilla 的Introduction_to_using_XPath_in_JavaScript
实现用户定义的命名空间解析器
function nsResolver(prefix) {
var ns = {
'xhtml' : 'http://www.w3.org/1999/xhtml',
'mathml': 'http://www.w3.org/1998/Math/MathML'
};
return ns[prefix] || null;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
855 次 |
最近记录: |