Skip to content

Commit 668decd

Browse files
author
Zach Drayer
committed
Add autoreleased methods to TFHpple
1 parent fd5ec10 commit 668decd

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

TFHpple.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,13 @@
3939
}
4040

4141
- (id) initWithData:(NSData *)theData isXML:(BOOL)isDataXML;
42-
- (id) initWithHTMLData:(NSData *)theData;
4342
- (id) initWithXMLData:(NSData *)theData;
43+
- (id) initWithHTMLData:(NSData *)theData;
44+
45+
+ (TFHpple *) hppleWithData:(NSData *)theData isXML:(BOOL)isDataXML;
46+
+ (TFHpple *) hppleWithXMLData:(NSData *)theData;
47+
+ (TFHpple *) hppleWithHTMLData:(NSData *)theData;
48+
4449
- (NSArray *) searchWithXPathQuery:(NSString *)xPathOrCSS;
4550
- (TFHppleElement *) peekAtSearchWithXPathQuery:(NSString *)xPathOrCSS;
4651

TFHpple.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ - (id) initWithHTMLData:(NSData *)theData
6262
return [self initWithData:theData isXML:NO];
6363
}
6464

65+
+ (TFHpple *) hppleWithData:(NSData *)theData isXML:(BOOL)isDataXML {
66+
return [[[[self class] alloc] initWithData:theData isXML:isDataXML] autorelease];
67+
}
68+
69+
+ (TFHpple *) hppleWithHTMLData:(NSData *)theData {
70+
return [[self class] hppleWithData:theData isXML:NO];
71+
}
72+
73+
+ (TFHpple *) hppleWithXMLData:(NSData *)theData {
74+
return [[self class] hppleWithData:theData isXML:YES];
75+
}
76+
77+
#pragma mark -
78+
6579
// Returns all elements at xPath.
6680
- (NSArray *) searchWithXPathQuery:(NSString *)xPathOrCSS
6781
{

0 commit comments

Comments
 (0)