【问题标题】:How to get the table which is inside a TD of another Table via XPath如何通过 XPath 获取另一个表的 TD 内的表
【发布时间】:2014-04-02 14:24:45
【问题描述】:

我是 HTML 单元和 XPath 的新手。我不确定我需要用来提取另一个表的 TD 内的内部表内容的 XPath。我有以下类型的 XML

<table>
  <tr>
     <td></td>
     <td>
         <table>
           ...
           ... 
         </table> 
     </td> 
   </tr>
  </table>

在这里感谢任何帮助。

【问题讨论】:

    标签: java html xpath htmlunit


    【解决方案1】:

    所以您想使用 XPath 来获取内表。然后你应该应用相同的逻辑来获取外部表。

    如果你以这种方式到达外面的桌子:

    /path-to-outer-table/table
    

    然后,考虑到提供的 HTML 代码,您可以通过以下方式到达内部表格:

    /path-to-outer-table/table/tr/td/table
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-23
      • 2017-07-23
      • 2019-01-10
      相关资源
      最近更新 更多