I am using the hpple library to parse an html document. The document looks something like
<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>
I want to retrieve all these nodes using an xpath query. So, I try to do something like
TFHpple *parser = [TFHpple hppleWithHTMLData:htmlData];
NSString *xpathQueryString = @"//a[@class='title']";
NSArray *tutorialsNodes = [tutorialsParser searchWithXPathQuery:xpathQueryString];
But this understandably returns me only one node which is
<a class="title"> Promo - 19 Apr 2014</a>
Can I form an xpath search query with wildcards so it returns me all these nodes? I tried to form the search query as
NSString *xpathQueryString = @"//a[@class='title']";
but this did not help.
Can I achieve this using hpple? If not, what are my other options?
Thanks
Another possible way is using starts-with()
function :
//a[starts-with(@class,'title')]