CopyFor one thing, that's not valid HTML, but the more important issue is that you want to be looking at the children. The thing you are looking for is nested inside the div, not an attribute. Since your div only has one child, a quick look at the project you provided in the comments leads me to believe that the following will work:
HTMLNode *bodyNode = [parser body];
NSArray *imageNodes = [bodyNode findChildTags:@"div"];
for (HTMLNode *imageNode in imageNodes) {
if ([[imageNode getAttributeNamed:@"class"] isEqualToString:@"image"]) {
HTMLNode *aNode = [imageNode firstChild];
HTMLNode *imgNode = [aNode nextSibling];
NSLog(@"%@", [imgNode getAttributeNamed:@"src"]);
}
}
Post a Comment for "Parse Picture From Html In Objective-c"