ObjFW  Diff

Differences From Artifact [476d990507]:

To Artifact [fa5a63b34f]:


153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172



173
174
175
176
177
178
179
{
	self = [super init];

	@try {
		name = [name_ copy];
		ns = [ns_ copy];

		if (stringValue != nil) {
			OFAutoreleasePool *pool;

			pool = [[OFAutoreleasePool alloc] init];
			[self addChild:
			    [OFXMLElement elementWithCharacters: stringValue]];
			[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;
}







<
<
<
<
<
<
<
<
<




>
>
>







153
154
155
156
157
158
159









160
161
162
163
164
165
166
167
168
169
170
171
172
173
{
	self = [super init];

	@try {
		name = [name_ copy];
		ns = [ns_ copy];










		namespaces = [[OFMutableDictionary alloc]
		    initWithKeysAndObjects:
		    @"http://www.w3.org/XML/1998/namespace", @"xml",
		    @"http://www.w3.org/2000/xmlns/", @"xmlns", nil];

		if (stringValue != nil)
			[self setStringValue: stringValue];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}
268
269
270
271
272
273
274









































































275
276
277
278
279
280
281
	if (![parser finishedParsing])
		@throw [OFMalformedXMLException newWithClass: c
						      parser: parser];

	self = [delegate->element retain];

	@try {









































































		[pool release];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
	if (![parser finishedParsing])
		@throw [OFMalformedXMLException newWithClass: c
						      parser: parser];

	self = [delegate->element retain];

	@try {
		[pool release];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;
}

- initWithSerialization: (OFXMLElement*)element
{
	self = [super init];

	@try {
		OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
		OFXMLElement *attributesElement, *namespacesElement;
		OFXMLElement *childrenElement;

		if (![[element name] isEqual: @"object"] ||
		    ![[element namespace] isEqual: OF_SERIALIZATION_NS] ||
		    ![[[element attributeForName: @"class"] stringValue]
		    isEqual: [isa className]])
			@throw [OFInvalidArgumentException newWithClass: isa
							       selector: _cmd];

		name = [[[element
		    elementForName: @"name"
			 namespace: OF_SERIALIZATION_NS] stringValue] copy];
		ns = [[[element
		    elementForName: @"namespace"
			namespace: OF_SERIALIZATION_NS] stringValue] copy];
		defaultNamespace = [[[element
		    elementForName: @"defaultNamespace"
			 namespace: OF_SERIALIZATION_NS] stringValue] copy];
		characters = [[[element
		    elementForName: @"characters"
			 namespace: OF_SERIALIZATION_NS] stringValue] copy];
		CDATA = [[[element
		    elementForName: @"CDATA"
			 namespace: OF_SERIALIZATION_NS] stringValue] copy];
		comment = [[[element
		    elementForName: @"comment"
			 namespace: OF_SERIALIZATION_NS] stringValue] copy];

		attributesElement = [element
		    elementForName: @"attributes"
			 namespace: OF_SERIALIZATION_NS];
		namespacesElement = [element
		    elementForName: @"namespaces"
			 namespace: OF_SERIALIZATION_NS];
		childrenElement = [element elementForName: @"children"
						namespace: OF_SERIALIZATION_NS];

		attributes = [[OFSerialization objectByDeserializingXMLElement:
		    [attributesElement elementForName: @"object"
					    namespace: OF_SERIALIZATION_NS]]
		    retain];
		namespaces = [[OFSerialization objectByDeserializingXMLElement:
		    [namespacesElement elementForName: @"object"
					    namespace: OF_SERIALIZATION_NS]]
		    retain];
		children = [[OFSerialization objectByDeserializingXMLElement:
		    [childrenElement elementForName: @"object"
					  namespace: OF_SERIALIZATION_NS]]
		    retain];

		if (!((name != nil || ns != nil || defaultNamespace != nil ||
		    [attributes count] > 0 || [namespaces count] > 0 ||
		    [children count] > 0) ^ (characters != nil) ^
		    (CDATA != nil) ^ (comment != nil)))
			@throw [OFInvalidArgumentException newWithClass: isa
							       selector: _cmd];

		[pool release];
	} @catch (id e) {
		[self release];
		@throw e;
	}

	return self;