Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Return nil if no children are found with childrenNamed #11

Merged
merged 1 commit into from

2 participants

@Thomazr

Hi,

I use your class in one of my projects and made a change, so childrenNamed will behave like childNamed if no child is found.

Thanks!

  • Thomas
@nfarina nfarina merged commit cd97da6 into from
@nfarina
Owner

Good call, this behavior is indeed better. Thanks for the patch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +5 −1 SMXMLDocument.m
View
6 SMXMLDocument.m
@@ -114,7 +114,11 @@ - (NSArray *)childrenNamed:(NSString *)nodeName {
for (SMXMLElement *child in children)
if ([child.name isEqual:nodeName])
[array addObject:child];
- return [[array copy] autorelease];
+
+ if([array count] > 0)
+ return [[array copy] autorelease];
+ else
+ return nil;
}
- (SMXMLElement *)childWithAttribute:(NSString *)attributeName value:(NSString *)attributeValue {
Something went wrong with that request. Please try again.