Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我如何使用 Hpple/Xpath for iPhone获取URL_TO_GRAB ?我需要使用一些正则表达式吗?
<div class="content"> <a href="URL_TO_GRAB"> Link </a> </div>
谢谢一堆。
你应该可以像这样得到它,
NSArray * elements = [doc search:@"//a"]; for ( TFHppleElement * element in elements ) { NSString * URLString = [[element attributes] objectForKey:@"href"]; NSLog(@"%@", URLString); }
这匹配所有锚链接并打印它们的 url。