【问题标题】:Xidel: How to printout the node instead of the value?Xidel:如何打印出节点而不是值?
【发布时间】:2020-06-16 03:21:15
【问题描述】:

html 示例:

<p class="si-price" data-price="910000.00">Rp 910.000</p>

所以在 xidel,我这样做:

xidel -se '(//p[@class="si-price"])[1]' 'https://www.anekalogam.co.id/id'

我想要的是910000,它在data-price而不是Rp 910.000

我可以这样做吗?

【问题讨论】:

    标签: xpath xidel


    【解决方案1】:

    尝试将其更改为:

    xidel -se '(//p[@class="si-price"])/@data-price' 'https://www.anekalogam.co.id/id'
    

    输出:

    905000.00
    1750000.00
    2595000.00
    4300000.00
    8550000.00
    21250000.00
    42400000.00
    84000000.00
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-02
      • 2014-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多