- 授权协议: 未知
- 开发语言: Objective-C
- 操作系统: OS X
- 软件首页: https://github.com/zootreeves/Objective-C-HMTL-Parser
软件介绍
Objective-C-HMTL-Parser 是一个用 ObjectiveC 编写的简易 HTML 解析器。
示例代码:
NSError *error = nil; NSString *html = @"<ul>" "<li><input type='image' name='input1' value='string1value' /></li>" "<li><input type='image' name='input2' value='string2value' /></li>" "</ul>" "<span class='spantext'><b>Hello World 1</b></span>" "<span class='spantext'><b>Hello World 2</b></span>"; HTMLParser *parser = [[HTMLParser alloc] initWithString:html error:&error]; if (error) { NSLog(@"Error: %@", error); return; } HTMLNode *bodyNode = [parser body]; NSArray *inputNodes = [bodyNode findChildTags:@"input"]; for (HTMLNode *inputNode in inputNodes) { if ([[inputNode getAttributeNamed:@"name"] isEqualToString:@"input2"]) { NSLog(@"%@", [inputNode getAttributeNamed:@"value"]); //Answer to first question } } NSArray *spanNodes = [bodyNode findChildTags:@"span"]; for (HTMLNode *spanNode in spanNodes) { if ([[spanNode getAttributeNamed:@"class"] isEqualToString:@"spantext"]) { NSLog(@"%@", [spanNode rawContents]); //Answer to second question } } [parser release];
About Face 3
Alan Cooper、Robert Reimann、David Cronin / John Wiley & Sons / 2007-5-15 / GBP 28.99
* The return of the authoritative bestseller includes all new content relevant to the popularization of how About Face maintains its relevance to new Web technologies such as AJAX and mobile platforms......一起来看看 《About Face 3》 这本书的介绍吧!
