Xpather不会在firefox 3.5上评估XPath,但在firefox 3.6上可以正常工作

|| 我正在开发一个richface应用程序,并尝试在firefox3.5上使用xpather评估以下xpath。虽然相同的xpath在firefox 3.6上运行得很好,但是XPather不会评估任何xpath。 我正在测试的页面就像-
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" 
                      \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:o=\"http://openfaces.org\">
  <head>
    <script src=\"some source\" type=\"text/javascript\"></script>
    <script src=\"some source\" type=\"text/javascript\"></script>
    <link class=\"component\" href=\"some source\" rel=\"stylesheet\" type=\"text/css\" />
    <link class=\"component\" href=\"some source\" 
          media=\"rich-extended-skinning\" rel=\"stylesheet\" type=\"text/css\" />
    <link class=\"component\" href=\"some source\" rel=\"stylesheet\" type=\"text/css\" />
    <script type=\"text/javascript\">window.RICH_FACES_EXTENDED_SKINNING_ON=true;</script>
    <link type=\"text/css\" href=\"some source\" rel=\"stylesheet\"/>

  <body class=\"Banner\" onresize=\"setTreePnlHeight()\" onload=\"loadApp();\">
    <input type=\"hidden\" id=\"dsTreeScrollPos\" value=\"0\" />
    <div id=\"a\" class=\"application\"><form id=\"form\" name=\"form\" method=\"post\" action=\"...\">
    ....
  </body>
</html>
如果我使用xpather(v1.4.5)来评估FF3.5上的简单xpath(如
//input
),则不会返回任何结果。命名空间是否会导致此问题?如何验证FF3.5上的xpath?     
已邀请:
           FF3.5上的简单xpath,例如
//input
,它   不返回任何结果。是   命名空间导致此问题? 是。如果查看您的文档,则那里有一个默认的名称空间定义。
<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:o=\"http://openfaces.org\">
这意味着
//input
正在寻找没有名称空间的元素
<input>
,而您应寻找
http://www.w3.org/1999/xhtml
名称空间中的
<input>
。您需要定义该名称空间并将其绑定到前缀,然后在XPath中使用该前缀。像
//x:input
    

要回复问题请先登录注册