IOS Parse HTML Attribute With Hpple
I am trying to retrieve an attribute in an input tag in HTML. My NSLog is coming back null. What's wrong with my syntax? I am trying to retrieve the value for 'value=' in the input
Solution 1:
I imagine this could be solved better with different XPath query and inspection of the attributes, something maybe like:
NSArray *elements = [xpathParser searchWithXPathQuery:@"//input[@id='hidXMLID']"];
TFHppleElement *element = [elements objectAtIndex:0];
NSDictionary *attributes = [element attributes];
NSString *idValue = [attributes objectForKey:@"id"];
From your post and your logs, I think that this may work without changing the query:
TFHppleElement *element = [elements objectAtIndex:0];
TFHppleElement *child = [element.children objectAtIndex:0];
NSString *idValue = [child content];
Post a Comment for "IOS Parse HTML Attribute With Hpple"