app xml 与html,GitHub - 9191app/hpple: An XML/HTML parser for Objective-C, inspired by Hpricot.

ec20830df060885f98cc5f990b0144fc.png

DESCRIPTION

Hpple: A nice Objective-C wrapper on the XPathQuery library for parsing HTML.

Inspired by why the lucky stiff's Hpricot.

CREDITS

Hpple was created by Geoffrey Grosenbach, Topfunky Corporation and PeepCode Screencasts.

FEATURES

Easy searching by XPath (CSS selectors are planned)

Parses HTML (XML coming soon)

Easy access to tag content, name, and attributes.

INSTALLATION

Open your XCode project and the Hpple project.

Drag the "Hpple" directory to your project.

Add the libxml2.2.dylib framework to your project and search paths as described at Cocoa with Love

More documentation and short screencast coming soon...

USAGE

See TFHppleHTMLTest.m in the Hpple project for samples.

#import "TFHpple.h"

NSData * data = [NSData dataWithContentsOfFile:@"index.html"];

TFHpple * doc = [[TFHpple alloc] initWithHTMLData:data];

NSArray * elements = [doc search:@"//a[@class='sponsor']"];

TFHppleElement * element = [elements objectAtIndex:0];

[e text]; // The text inside the HTML element (the content of the first text node)

[e tagName]; // "a"

[e attributes]; // NSDictionary of href, class, id, etc.

[e objectForKey:@"href"]; // Easy access to single attribute

[e firstChildWithTagName:@"b"]; // The first "b" child node

TODO

Internal error catching and messages

CSS3 selectors in addition to XPath

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值