Index: src/OFXMLElement.h ================================================================== --- src/OFXMLElement.h +++ src/OFXMLElement.h @@ -415,10 +415,17 @@ * * \param child Another OFXMLElement which is added as a child */ - (void)addChild: (OFXMLElement*)child; +/** + * Removes the first child that is equal to the specified OFXMLElement. + * + * \param child The child to remove from the OFXMLElement + */ +- (void)removeChild: (OFXMLElement*)child; + /** * Returns all children that are elements. * * \return All children that are elements */ Index: src/OFXMLElement.m ================================================================== --- src/OFXMLElement.m +++ src/OFXMLElement.m @@ -1030,10 +1030,19 @@ if (children == nil) children = [[OFMutableArray alloc] init]; [children addObject: child]; } + +- (void)removeChild: (OFXMLElement*)child +{ + if (name == nil) + @throw [OFInvalidArgumentException newWithClass: isa + selector: _cmd]; + + [children removeObject: child]; +} - (OFXMLElement*)elementForName: (OFString*)elementName { return [[self elementsForName: elementName] firstObject]; }