OC解析html的类库Hpple的一些方法

来源:互联网 发布:编程语言 脚本语言 编辑:程序博客网 时间:2024/05/17 04:07


TFHppleElement的一些属性和方法//返回一个为转变的字符串@property (nonatomic, copy, readonly) NSString *raw;// Returns this tag's innerHTML content.返回nodeContent的值@property (nonatomic, copy, readonly) NSString *content;// Returns the name of the current tag, such as "h3".返回标签名@property (nonatomic, copy, readonly) NSString *tagName;// Returns tag attributes with name as key and content as value.反回一个子典, 属性名为key, 属性的内容为value//   href  = 'http://peepcode.com'//   class = 'highlight'@property (nonatomic, strong, readonly) NSDictionary *attributes;// Returns the children of a given node返回了一个节点的所有子节点数组@property (nonatomic, strong, readonly) NSArray *children;// Returns the first child of a given node@property (nonatomic, strong, readonly) TFHppleElement *firstChild;// the parent of a node@property (nonatomic, unsafe_unretained, readonly) TFHppleElement *parent;// Returns YES if the node has any child// This is more efficient than using the children property since no NSArray is constructed- (BOOL)hasChildren;// Returns YES if this is a text node- (BOOL)isTextNode;// Provides easy access to the content of a specific attribute, // such as 'href' or 'class'.- (NSString *) objectForKey:(NSString *) theKey;// Returns the children whose tag name equals the given string// (comparison is performed with NSString's isEqualToString)// Returns an empty array if no matching child is found- (NSArray *) childrenWithTagName:(NSString *)tagName;// Returns the first child node whose tag name equals the given string// (comparison is performed with NSString's isEqualToString)// Returns nil if no matching child is found- (TFHppleElement *) firstChildWithTagName:(NSString *)tagName;// Returns the children whose class equals the given string// (comparison is performed with NSString's isEqualToString)// Returns an empty array if no matching child is found- (NSArray *) childrenWithClassName:(NSString *)className;// Returns the first child whose class requals the given string// (comparison is performed with NSString's isEqualToString)// Returns nil if no matching child is found- (TFHppleElement *) firstChildWithClassName:(NSString*)className;// Returns the first text node from this element's children// Returns nil if there is no text node among the children- (TFHppleElement *) firstTextChild;// Returns the string contained by the first text node from this element's children// Convenience method which can be used instead of firstTextChild.content- (NSString *) text;// Returns elements searched with xpath- (NSArray *) searchWithXPathQuery:(NSString *)xPathOrCSS;// Custom keyed subscripting- (id)objectForKeyedSubscript:(id)key;


0 0
原创粉丝点击