Created
May 17, 2017 20:49
-
-
Save davidfmiller/1d3d6b07dafcd8e3b0f782325606f9a9 to your computer and use it in GitHub Desktop.
NSXMLNode+StringForXPath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "NSXMLNode+StringForXPath.h" | |
@implementation NSXMLNode (StringForXPath) | |
- (NSString *) stringForXPath:(NSString*)xpath | |
{ | |
NSError *error; | |
NSArray *nodes = [self nodesForXPath:xpath error:&error]; | |
if (error || nodes.count == 0) | |
{ | |
return nil; | |
} | |
return [[nodes objectAtIndex:0] stringValue]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment