我想为我的 iphone 应用程序解析以下 html 代码
<Html>
<body>
<div class="div_1">
<div class="div_2">some code....</div>
<div class="div_3">
<div class="div_4">
<div class="div_5">
<p>First Paragraph</p>
<p>Second Paragraph</p>
<p>Third Paragraph</p>
<p>Fourth Paragraph</p>
</div>
</div>
</div>
</div>
</body>
</Html>
我正在使用 Hpple 解析器来解析这个 html。我正在使用的 xpath 查询是
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:getHTMLData];
NSArray *elementsToSearch = [xpathParser searchWithXPathQuery:@"//div[@class='div_5']/p"];
TFHppleElement *element = [elementsToSearch objectAtIndex:0];
我想要得到的是 div class="div_5" 中的所有 p 标签内容。使用上面的 xpath 查询,我只得到第一个 p 标签内容,即“第一段”。我在我的 xpath 中做错了什么吗?