R:如何获取嵌套结构的xpath表达式

时间:2013-10-19 16:33:51

标签: regex r xpath

以下是html代码:

<div class="grid1-4">
  <a class="largeButton javascript sponsorProject button orangeGrad" href="javascript:;">
  <div class="button">
  <div class="button progress">
     <div class="progressWrapper">
         <div class="meter">
            <div class="progress" style="width:52%"> </div>
         </div>
         <p class="progressText">
         <span>52% Raised of $20,000 Goal</span>

我想在代码的最底部提取句子 - 即52% Raised of $20,000 Goal

那是什么xpath表达式?我用Google搜索并搜索了一些提示,但无法从中得到很多...... :(。我甚至用firebug来查找xpath表达式但仍没有进展......

谢谢

PS:由于我的项目的性质,我不能写

  //p[@class="progressText"]//span

xpath表达式HAS TO INVOLVE

  <div class="grid1-4">

1 个答案:

答案 0 :(得分:0)

此XPath:

//div[@class="grid1-4"]//text()[contains(., 'Raised of')]

<强>收率:

52% Raised of $20,000 Goal