html - Get the href value using XPath/Hpple/Objective-C -


i tried makes (and doesn't make) sense me. have following html code try parse xpath in objective-c:

<tr style="background-color: #eaeaea">    <td class="content">       <a href="index.php?cmd=search&id=foo">bar</a>    </td> </tr> 

i "bar" via //tr/td[@class='content']/a/text().

but have no idea how index.php?cmd=search&id=foo.

it drives me despair :-(

thank help!

after trying whole night (again) found out how solve problem:

//put elements in array nsarray *somearray = [xpathparser searchwithxpathquery:@"//tr/td[@class='content']/a"];  //just 1 possibility make for-loop (tfhppleelement *element in somearray) {     //this important line:     nsstring *myurl = [[element attributes] objectforkey:@"href"];     //do whatever want myurl } 

i hope helps folks out there!


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -