我正在使用 hpple 库来解析 html 文档。该文件看起来像
<a class="title threadtitle_unread">Promo - 20 Apr 2014</a>
<a class="title"> Promo - 19 Apr 2014</a>
<a class="title unread"> Promo - 18 Apr 2014</a>
<a class="title special"> Promo - 17 Apr 2014</a>
<a class="title threadtitle_unread">Promo - 16 Apr 2014</a>
我想使用 xpath 查询检索所有这些节点。所以,我尝试做类似的事情
TFHpple *parser = [TFHpple hppleWithHTMLData:htmlData];
NSString *xpathQueryString = @"//a[@class='title']";
NSArray *tutorialsNodes = [tutorialsParser searchWithXPathQuery:xpathQueryString];
但这可以理解地只返回一个节点,它是
<a class="title"> Promo - 19 Apr 2014</a>
我可以使用通配符形成一个 xpath 搜索查询,以便它返回所有这些节点吗?我试图将搜索查询形成为
NSString *xpathQueryString = @"//a[@class='title']";
但这没有帮助。
我可以使用 hpple 实现这一目标吗?如果没有,我的其他选择是什么?
谢谢