从网页使用XPATH和命名空间读取数据

I am trying use IMPORTXML on google sheets on https://travel.rakuten.co.jp/HOTEL/40130/review.html to get the review for each category, like food/ service but I am stuck.

具体部分是

<dd>
<ul>
<li><span class="name">サービス</span><span class="rate rate35">3.43</span></li>
<li><span class="name">立地</span><span class="rate rate40">3.79</span></li>
<li><span class="name">部屋</span><span class="rate rate35">3.14</span></li>
<li><span class="name">設備・アメニティ</span><span class="rate rate35">3.43</span></li>
<li><span class="name">風呂</span><span class="rate rate40">3.64</span></li>
<li><span class="name">食事</span><span class="rate rate35">3.50</span></li>
</ul>
</dd>

到目前为止,我使用的是XPATH,但它不起作用。

//*[local-name()='span'][@class='name'][text()='立地']/following-sibling::*/*[local-name() = 'span']

The Google sheet can be found here: https://docs.google.com/spreadsheets/d/1EhZhyhhVyUHQJ1FOTSSyWnqtmD9zKRRGaAlvKcFMn4g/edit#gid=1848100649

评论