Skip to content

Commit

Permalink
[CXMLNode_XPathExtensions] Added a convenient method to retrieve a si…
Browse files Browse the repository at this point in the history
…ngle node with namespace mapping.
  • Loading branch information
pylebecq committed May 15, 2012
1 parent 7bd9f17 commit e84bc8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/CXMLNode_XPathExtensions.h
Expand Up @@ -34,6 +34,7 @@
@interface CXMLNode (CXMLNode_XPathExtensions)

- (NSArray *)nodesForXPath:(NSString *)xpath namespaceMappings:(NSDictionary *)inNamespaceMappings error:(NSError **)error;
- (CXMLNode *)nodeForXPath:(NSString *)xpath namespaceMappings:(NSDictionary *)inNamespaceMappings error:(NSError **)error;
- (CXMLNode *)nodeForXPath:(NSString *)xpath error:(NSError **)outError;

@end
7 changes: 6 additions & 1 deletion Source/CXMLNode_XPathExtensions.m
Expand Up @@ -37,7 +37,7 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>

@implementation CXMLNode (CXMLNode_NamespaceExtensions)
@implementation CXMLNode (CXMLNode_XPathExtensions)

- (NSArray *)nodesForXPath:(NSString *)xpath namespaceMappings:(NSDictionary *)inNamespaceMappings error:(NSError **)error;
{
Expand Down Expand Up @@ -78,6 +78,11 @@ - (NSArray *)nodesForXPath:(NSString *)xpath namespaceMappings:(NSDictionary *)i
return(theResult);
}

- (CXMLNode *)nodeForXPath:(NSString *)xpath namespaceMappings:(NSDictionary *)inNamespaceMappings error:(NSError **)error
{
return [[self nodesForXPath:xpath namespaceMappings:inNamespaceMappings error:error] lastObject];
}

- (CXMLNode *)nodeForXPath:(NSString *)xpath error:(NSError **)outError
{
return([[self nodesForXPath:xpath error:outError] lastObject]);
Expand Down

0 comments on commit e84bc8d

Please sign in to comment.