hpple
hpple copied to clipboard
node's parent is nil
my html code is like this:
- python1
- python2
And my objc code is: TFHpple* hpple = [TFHpple hppleWithHTMLData:data]; NSArray* links = [hpple searchWithXPathQuery:@"//a[@href!='']"]; for (TFHppleElement* link in links) { NSLog(@"link's parent: %@", link.parent); }
The output shows that the link's parent is nil, while it should be
I believe that xPath starts recording at the "a" node. If you had started at the "ul" or "li" node then when you get to the "a" node, parent would contain the "li" node and the "li" node would, in turn, contain a parent as the "ul" node.