ObjFW  Diff

Differences From Artifact [dfde4a28b8]:

To Artifact [d290a6e873]:


564
565
566
567
568
569
570
571

572
573
574
575










576
577



578
579


580



581
582


583

584
585
586
587
588
589










590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605







606
607
608
609
610
611
612
613
614
615



































616


617

618
619
620
621
622
623
624
564
565
566
567
568
569
570

571
572



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587


588
589
590
591
592
593


594
595
596
597






598
599
600
601
602
603
604
605
606
607
















608
609
610
611
612
613
614
615









616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653

654
655
656
657
658
659
660
661







-
+

-
-
-
+
+
+
+
+
+
+
+
+
+


+
+
+
-
-
+
+

+
+
+
-
-
+
+

+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+

-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+
+
-
+







}

- (OFString*)description
{
	return [self XMLString];
}

- (OFString*)stringBySerializing
- (OFXMLElement*)XMLElementBySerializing
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFMutableDictionary *dictionary = [OFMutableDictionary dictionary];
	OFString *ret;
	OFAutoreleasePool *pool;
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: @"object"
				      namespace: OF_SERIALIZATION_NS];

	pool = [[OFAutoreleasePool alloc] init];

	[element addAttributeWithName: @"class"
			  stringValue: [self className]];

	if (name != nil)
		[element addChild:
		    [OFXMLElement elementWithName: @"name"
					namespace: OF_SERIALIZATION_NS
		[dictionary setObject: name
			       forKey: @"name"];
				      stringValue: name]];

	if (ns != nil)
		[element addChild:
		    [OFXMLElement elementWithName: @"namespace"
					namespace: OF_SERIALIZATION_NS
		[dictionary setObject: ns
			       forKey: @"namespace"];
				      stringValue: ns]];

	if (defaultNamespace != nil)
		[element addChild:
		[dictionary setObject: defaultNamespace
			       forKey: @"defaultNamespace"];
	if (attributes != nil)
		[dictionary setObject: attributes
			       forKey: @"attributes"];
	if (namespaces != nil)
		    [OFXMLElement elementWithName: @"defaultNamespace"
					namespace: OF_SERIALIZATION_NS
				      stringValue: defaultNamespace]];

	if (attributes != nil) {
		OFXMLElement *attributesElement;

		attributesElement =
		    [OFXMLElement elementWithName: @"attributes"
					namespace: OF_SERIALIZATION_NS];
		[dictionary setObject: namespaces
			       forKey: @"namespaces"];
	if (children != nil)
		[dictionary setObject: children
			       forKey: @"children"];
	if (characters != nil)
		[dictionary setObject: characters
			       forKey: @"characters"];
	if (CDATA != nil)
		[dictionary setObject: CDATA
			       forKey: @"CDATA"];
	if (comment != nil)
		[dictionary setObject: comment
			       forKey: @"comment"];

	dictionary->isa = [OFDictionary class];
		[attributesElement addChild:
		    [attributes XMLElementBySerializing]];
		[element addChild: attributesElement];
	}

	if (namespaces != nil) {
		OFXMLElement *namespacesElement;

	ret = [[OFString alloc]
	    initWithFormat: @"(class=OFXMLElement,version=0)<%@>",
			    [dictionary stringBySerializing]];

	@try {
		[pool release];
	} @finally {
		[ret autorelease];
	}
		namespacesElement =
		    [OFXMLElement elementWithName: @"namespaces"
					namespace: OF_SERIALIZATION_NS];
		[namespacesElement addChild:
		    [namespaces XMLElementBySerializing]];
		[element addChild: namespacesElement];
	}

	if (children != nil) {
		OFXMLElement *childrenElement;

		childrenElement =
		    [OFXMLElement elementWithName: @"children"
					namespace: OF_SERIALIZATION_NS];
		[childrenElement addChild: [children XMLElementBySerializing]];
		[element addChild: childrenElement];
	}

	if (characters != nil)
		[element addChild:
		    [OFXMLElement elementWithName: @"characters"
					namespace: OF_SERIALIZATION_NS
				      stringValue: characters]];

	if (CDATA != nil)
		[element addChild:
		    [OFXMLElement elementWithName: @"CDATA"
					namespace: OF_SERIALIZATION_NS
				      stringValue: CDATA]];

	if (comment != nil)
		[element addChild:
		    [OFXMLElement elementWithName: @"comment"
					namespace: OF_SERIALIZATION_NS
				      stringValue: comment]];

	[pool release];

	return ret;
	return element;
}

- (void)addAttribute: (OFXMLAttribute*)attribute
{
	if (name == nil)
		@throw [OFInvalidArgumentException newWithClass: isa
						       selector: _cmd];