Hi,

can someone look at and say is a returning of immutable objects necessary or
no?

@interface XMLElement : NSObject {


 NSString *_name;

NSMutableString *_text;

 NSMutableDictionary *_attributes;

NSMutableArray *_children;

 XMLElement *_parent;

}

@implementation XMLElement


- (NSArray *) elementsForName: (NSString *) name {

 NSMutableArray *children = [NSMutableArray new];

 for (XMLElement *element in _children)

if ([[element name] isEqualToString: name])

[children addObject: element];

 NSArray *lchildren = [children copy];

[children release];

 return [lchildren autorelease];

}

- (void) setChildren: (NSArray *) children {

 [_children release];

_children = [children mutableCopy];

}


- (NSArray *) children {

 return [[_children copy] autorelease];

}

- (NSString *) XMLString {

 return [[[self _XMLString] copy] autorelease];

}

//


@end


-- 
best regards
Ariel
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to