Skip to content

Commit

Permalink
Merge pull request #2 from premosystems/master
Browse files Browse the repository at this point in the history
Added the ability to react to an already instantiated NSXMLParser (courtesy of @premosystems)
  • Loading branch information
aceontech committed Jul 21, 2015
2 parents 029b0ef + c9eaa1a commit 5be0e03
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Pod::Spec.new do |s|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

s.name = "ReactiveNSXMLParser"
s.version = "0.1.1"
s.version = "0.1.2"
s.summary = "ReactiveCocoa extensions for NSXMLParser: A concise, stream-based API for parsing XML with NSXMLParser."

s.description = <<-DESC
Expand All @@ -29,7 +29,7 @@ Pod::Spec.new do |s|

# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

s.ios.deployment_target = '5.0'
s.ios.deployment_target = '6.0'
s.osx.deployment_target = '10.7'


Expand Down
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 5be0e03

Please sign in to comment.