@@ -66,11 +66,13 @@ return [[[self alloc] initWithComment: comment] autorelease]; } - init { - @throw [OFNotImplementedException newWithClass: isa + Class c = isa; + [self release]; + @throw [OFNotImplementedException newWithClass: c selector: _cmd]; } - initWithName: (OFString*)name_ { @@ -99,50 +101,73 @@ namespace: (OFString*)ns_ stringValue: (OFString*)stringval { self = [super init]; - name = [name_ copy]; - ns = [ns_ copy]; - - if (stringval != nil) { - OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];; - [self addChild: - [OFXMLElement elementWithCharacters: stringval]]; - [pool release]; - } - - namespaces = [[OFMutableDictionary alloc] initWithKeysAndObjects: - @"http://www.w3.org/XML/1998/namespace", @"xml", - @"http://www.w3.org/2000/xmlns/", @"xmlns", nil]; + @try { + name = [name_ copy]; + ns = [ns_ copy]; + + if (stringval != nil) { + OFAutoreleasePool *pool; + + pool = [[OFAutoreleasePool alloc] init];; + [self addChild: + [OFXMLElement elementWithCharacters: stringval]]; + [pool release]; + } + + namespaces = [[OFMutableDictionary alloc] + initWithKeysAndObjects: + @"http://www.w3.org/XML/1998/namespace", @"xml", + @"http://www.w3.org/2000/xmlns/", @"xmlns", nil]; + } @catch (id e) { + [self release]; + @throw e; + } return self; } - initWithCharacters: (OFString*)chars { self = [super init]; - characters = [chars copy]; + @try { + characters = [chars copy]; + } @catch (id e) { + [self release]; + @throw e; + } return self; } - initWithCDATA: (OFString*)cdata_ { self = [super init]; - cdata = [cdata_ copy]; + @try { + cdata = [cdata_ copy]; + } @catch (id e) { + [self release]; + @throw e; + } return self; } - initWithComment: (OFString*)comment_ { self = [super init]; - comment = [comment_ copy]; + @try { + comment = [comment_ copy]; + } @catch (id e) { + [self release]; + @throw e; + } return self; } - (OFString*)name @@ -227,11 +252,11 @@ namespace: ns]; len += [prefix cStringLength] + 1; @try { str_c = [self resizeMemory: str_c toSize: len]; - } @catch (OFException *e) { + } @catch (id e) { [self freeMemory: str_c]; @throw e; } memcpy(str_c + i, [prefix cString], @@ -265,11 +290,11 @@ [tmp cStringLength] + 4; @try { str_c = [self resizeMemory: str_c toSize: len]; - } @catch (OFException *e) { + } @catch (id e) { [self freeMemory: str_c]; @throw e; } str_c[i++] = ' '; @@ -310,11 +335,11 @@ len += [tmp cStringLength] + [name cStringLength] + 2; @try { str_c = [self resizeMemory: str_c toSize: len]; - } @catch (OFException *e) { + } @catch (id e) { [self freeMemory: str_c]; @throw e; } str_c[i++] = '>'; @@ -325,11 +350,11 @@ if (prefix != nil) { len += [prefix cStringLength] + 1; @try { str_c = [self resizeMemory: str_c toSize: len]; - } @catch (OFException *e) { + } @catch (id e) { [self freeMemory: str_c]; @throw e; } memcpy(str_c + i, [prefix cString],