@@ -714,14 +714,12 @@ @try { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *typeString; - if (![[element name] isEqual: @"object"] || - ![[element namespace] isEqual: OF_SERIALIZATION_NS] || - ![[[element attributeForName: @"class"] stringValue] - isEqual: [self className]]) + if (![[element name] isEqual: [self className]] || + ![[element namespace] isEqual: OF_SERIALIZATION_NS]) @throw [OFInvalidArgumentException newWithClass: isa selector: _cmd]; typeString = [[element attributeForName: @"type"] stringValue]; @@ -1175,21 +1173,16 @@ } } - (OFXMLElement*)XMLElementBySerializing { - OFAutoreleasePool *pool; + OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFXMLElement *element; - element = [OFXMLElement elementWithName: @"object" - namespace: OF_SERIALIZATION_NS]; - - pool = [[OFAutoreleasePool alloc] init]; - - [element addAttributeWithName: @"class" - stringValue: [self className]]; - [element setStringValue: [self description]]; + element = [OFXMLElement elementWithName: [self className] + namespace: OF_SERIALIZATION_NS + stringValue: [self description]]; switch (type) { case OF_NUMBER_BOOL: [element addAttributeWithName: @"type" stringValue: @"boolean"]; @@ -1253,10 +1246,15 @@ break; default: @throw [OFInvalidFormatException newWithClass: isa]; } - [pool release]; + [element retain]; + @try { + [pool release]; + } @finally { + [element autorelease]; + } return element; } @end