Skip to content

Commit

Permalink
Updated for more convenience methods
Browse files Browse the repository at this point in the history
  • Loading branch information
vincilbishop committed Jul 6, 2015
1 parent e9561da commit c9eaa1a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,20 @@ typedef BOOL (^ElementFilterBlock)(NSString *elementName);
+ (RACSignal *)rac_dictionaryFromString:(NSString *)string
elementFilter:(ElementFilterBlock)filterBlock;

/**
* Parse a XML using a pre-init'ed parser.
*
* @return RACSignal Will 'next' exactly once, with a NSDictionary parameter
*/
- (RACSignal *)rac_parser;

/**
* Parse a XML using a pre-init'ed parser.
*
* @param filterBlock ElementFilterBlock (optional) Enables filtering on an element-name level
*
* @return RACSignal Will 'next' exactly once, with a NSDictionary parameter
*/
- (RACSignal *)rac_parserWithElementFilter:(ElementFilterBlock)filterBlock;

@end
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ + (RACSignal *)rac_dictionaryFromData:(NSData *)data elementFilter:(ElementFilte
return [self rac_dictionaryFromSignal:[self rac_parseData:data] elementfilter:filterBlock];
}

- (RACSignal *)rac_parser
{
return [NSXMLParser rac_parseWithParser:self];
}

- (RACSignal *)rac_parserWithElementFilter:(ElementFilterBlock)filterBlock
{
return [NSXMLParser rac_dictionaryFromSignal:[self rac_parser] elementfilter:filterBlock];
}

#pragma mark - Internal

/**
Expand Down

0 comments on commit c9eaa1a

Please sign in to comment.