I was following raywenderlich's tutorial on how to parse html into xcode and it works when it comes down to his website.However, the only problem now is I seem to not grasp the concept of Xpathquery.All I want is the table data.This is the html code below.
<div>
<table class="detail-view" id="yw0"><tr class="odd"><th>ID</th><td>kick</td></tr>
I thought the code below would work, but it didn't. Any help will be appreciated
NSString *tutorialsXpathQueryString = @"//table[@class='detail-view']/td";
I'm not sure exactly what you're trying to extract from the table; but I'm going to infer that it's the element <td>kick</td>
. In that case, using the following source:
<table class="detail-view" id="yw0"><tr class="odd"><th>ID</th><td>kick</td></tr></table>
and an XPath query string of:
//table[@class='detail-view']/tr/td
I get a result of:
Element='<td>kick</td>'
Perhaps you could use this tool to tune your queries.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.