57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
-
-
+
+
-
-
-
-
+
+
-
-
+
-
-
-
-
+
+
+
-
|
- initWithSerialization: (OFXMLElement*)element
{
self = [super init];
@try {
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
if (![[element name] isEqual: @"object"] ||
![[element namespace] isEqual: OF_SERIALIZATION_NS] ||
if (![[element name] isEqual: [self className]] ||
![[element namespace] isEqual: OF_SERIALIZATION_NS])
![[[element attributeForName: @"class"] stringValue]
isEqual: [self className]])
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
name = [[[element
elementForName: @"name"
name = [[[element attributeForName: @"name"] stringValue]
copy];
namespace: OF_SERIALIZATION_NS] stringValue] retain];
ns = [[[element
ns = [[[element attributeForName: @"namespace"] stringValue]
elementForName: @"namespace"
namespace: OF_SERIALIZATION_NS] stringValue] retain];
stringValue = [[[element
elementForName: @"stringValue"
copy];
stringValue = [[[element attributeForName: @"stringValue"]
stringValue] copy];
namespace: OF_SERIALIZATION_NS] stringValue] retain];
[pool release];
} @catch (id e) {
[self release];
@throw e;
}
|
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
-
+
-
+
-
-
-
-
+
+
-
-
-
-
-
+
-
-
-
-
-
+
+
+
-
-
+
+
+
-
+
+
+
+
|
OF_HASH_FINALIZE(hash);
return hash;
}
- (OFXMLElement*)XMLElementBySerializing
{
OFAutoreleasePool *pool;
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFXMLElement *element;
element = [OFXMLElement elementWithName: @"object"
element = [OFXMLElement elementWithName: [self className]
namespace: OF_SERIALIZATION_NS];
pool = [[OFAutoreleasePool alloc] init];
[element addAttributeWithName: @"class"
stringValue: [self className]];
[element addAttributeWithName: @"name"
stringValue: name];
[element addChild:
[OFXMLElement elementWithName: @"name"
namespace: OF_SERIALIZATION_NS
stringValue: name]];
if (ns != nil)
[element addChild:
[element addAttributeWithName: @"namespace"
[OFXMLElement elementWithName: @"namespace"
namespace: OF_SERIALIZATION_NS
stringValue: ns]];
[element addChild:
[OFXMLElement elementWithName: @"stringValue"
stringValue: ns];
[element addAttributeWithName: @"stringValue"
namespace: OF_SERIALIZATION_NS
stringValue: stringValue]];
stringValue: stringValue];
[element retain];
@try {
[pool release];
[pool release];
} @finally {
[element autorelease];
}
return element;
}
@end
|