Instantly share code, notes, and snippets.

Embed
What would you like to do?
NSXMLNode+StringForXPath
#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