ObjFW  Diff

Differences From Artifact [9fef639632]:

To Artifact [05eb8e5213]:


47
48
49
50
51
52
53
54

55
56

57
58
59
60
61
62
63
47
48
49
50
51
52
53

54
55

56
57
58
59
60
61
62
63







-
+

-
+







      stringValue: (OFString*)stringval
{
	return [[[self alloc] initWithName: name
				 namespace: ns
			       stringValue: stringval] autorelease];
}

+ elementWithText: (OFString*)text
+ elementWithCharacters: (OFString*)chars
{
	return [[[self alloc] initWithText: text] autorelease];
	return [[[self alloc] initWithCharacters: chars] autorelease];
}

+ elementWithComment: (OFString*)comment
{
	return [[[self alloc] initWithComment: comment] autorelease];
}

97
98
99
100
101
102
103
104


105
106
107
108
109
110
111
112
113
114
115

116
117
118
119

120
121
122
123
124
125
126
97
98
99
100
101
102
103

104
105
106
107
108
109
110
111
112
113
114
115

116
117
118
119

120
121
122
123
124
125
126
127







-
+
+










-
+



-
+







	self = [super init];

	name = [name_ copy];
	namespace = [ns copy];

	if (stringval != nil) {
		OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];;
		[self addChild: [OFXMLElement elementWithText: stringval]];
		[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];

	return self;
}

- initWithText: (OFString*)text_
- initWithCharacters: (OFString*)chars
{
	self = [super init];

	text = [text_ copy];
	characters = [chars copy];

	return self;
}

- initWithComment: (OFString*)comment_
{
	self = [super init];
138
139
140
141
142
143
144
145
146


147
148
149
150
151
152
153
139
140
141
142
143
144
145


146
147
148
149
150
151
152
153
154







-
-
+
+







	size_t len, i, j, attrs_count;
	OFString *prefix = nil;
	OFXMLAttribute **attrs_carray;
	OFString *ret, *tmp;
	OFMutableDictionary *all_namespaces;
	OFString *def_ns;

	if (text != nil)
		return [text stringByXMLEscaping];
	if (characters != nil)
		return [characters stringByXMLEscaping];

	if (comment != nil) {
		OFMutableString *str;

		str = [OFMutableString stringWithString: @"<!--"];
		[str appendString: comment];
		[str appendString: @"-->"];
427
428
429
430
431
432
433
434

435
436
437
438
439
428
429
430
431
432
433
434

435
436
437
438
439
440







-
+





- (void)dealloc
{
	[name release];
	[namespace release];
	[attributes release];
	[namespaces release];
	[children release];
	[text release];
	[characters release];
	[comment release];

	[super dealloc];
}
@end