iPhone用Hpple解析

时间:2010-11-04 07:07:01

标签: iphone

我正在使用hpple来解析html: 只有一个问题是:

<div class="Fiche">
  <p>Every Sunday, our Chef proposes a buffet high in color.
  <br />
  <br />
  A brunch either classic or on a theme for special events (Hallowe&rsquo;en, autumn...). Each time, you will be surprised by new culinary suggestions. Unlimited champagne.<br />
  <br />
  Every Sunday at the restaurant <a target="_blank" href="http://www.montecarlobay.com/THE-BLUE-BAY.html">Le Blue Bay</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
  <br />
  <br />
  Information/ reservations : (377) 98 06 03 60
 </p>

我的代码是:

NSArray *array4Soustitre = [xpathParser search:@"//div [@class='Fiche']/p"];
TFHppleElement *ele= [array4Soustitre objectAtIndex:0];
NSLog(@"content is %@ ",[ele content]);

我得到的只是:Information/ reservations : (377) 98 06 03 60 我想在<p></p>之间获取所有文字,<br />除外 任何帮助,非常感谢!

1 个答案:

答案 0 :(得分:1)

尝试:

NSArray *array4Soustitre = [xpathParser search:@"//div [@class='Fiche']/p/text()"];