237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
|
while ((key = [key_enum nextObject]) != nil &&
(obj = [obj_enum nextObject]) != nil)
[all_namespaces setObject: obj
forKey: key];
} else
all_namespaces = namespaces;
i = 0;
len = [name cStringLength] + 3;
str_c = [self allocMemoryWithSize: len];
/* Start of tag */
str_c[i++] = '<';
if ((ns == nil && def_ns != nil) || (ns != nil && def_ns == nil) ||
(ns != nil && ![ns isEqual: def_ns])) {
if ((prefix = [all_namespaces objectForKey:
(ns != nil ? ns : (OFString*)@"")]) == nil)
@throw [OFUnboundNamespaceException newWithClass: isa
namespace: ns];
len += [prefix cStringLength] + 1;
@try {
str_c = [self resizeMemory: str_c
toSize: len];
} @catch (id e) {
[self freeMemory: str_c];
@throw e;
}
memcpy(str_c + i, [prefix cString],
[prefix cStringLength]);
i += [prefix cStringLength];
str_c[i++] = ':';
}
memcpy(str_c + i, [name cString], [name cStringLength]);
i += [name cStringLength];
/* Attributes */
attrs_carray = [attributes cArray];
attrs_count = [attributes count];
pool2 = [[OFAutoreleasePool alloc] init];
for (j = 0; j < attrs_count; j++) {
|
>
>
<
|
<
<
<
<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
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
|
while ((key = [key_enum nextObject]) != nil &&
(obj = [obj_enum nextObject]) != nil)
[all_namespaces setObject: obj
forKey: key];
} else
all_namespaces = namespaces;
prefix = [all_namespaces objectForKey: (ns != nil ? ns : @"")];
i = 0;
len = [name cStringLength] + 3;
str_c = [self allocMemoryWithSize: len];
/* Start of tag */
str_c[i++] = '<';
if (prefix != nil && ![ns isEqual: def_ns]) {
len += [prefix cStringLength] + 1;
@try {
str_c = [self resizeMemory: str_c
toSize: len];
} @catch (id e) {
[self freeMemory: str_c];
@throw e;
}
memcpy(str_c + i, [prefix cString],
[prefix cStringLength]);
i += [prefix cStringLength];
str_c[i++] = ':';
}
memcpy(str_c + i, [name cString], [name cStringLength]);
i += [name cStringLength];
/* xmlns if necessary */
if (ns != nil && prefix == nil && ![ns isEqual: def_ns]) {
len += [ns cStringLength] + 9;
@try {
str_c = [self resizeMemory: str_c
toSize: len];
} @catch (id e) {
[self freeMemory: str_c];
@throw e;
}
memcpy(str_c + i, " xmlns='", 8);
i += 8;
memcpy(str_c + i, [ns cString], [ns cStringLength]);
i += [ns cStringLength];
str_c[i++] = '\'';
def_ns = ns;
}
/* Attributes */
attrs_carray = [attributes cArray];
attrs_count = [attributes count];
pool2 = [[OFAutoreleasePool alloc] init];
for (j = 0; j < attrs_count; j++) {
|
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
|
@selector(appendCStringWithoutUTF8Checking:)];
for (j = 0; j < children_count; j++)
append(tmp, @selector(
appendCStringWithoutUTF8Checking:),
[[children_carray[j]
_stringValueWithParentNamespaces: all_namespaces
parentDefaultNamespace: defaultNamespace] cString]);
len += [tmp cStringLength] + [name cStringLength] + 2;
@try {
str_c = [self resizeMemory: str_c
toSize: len];
} @catch (id e) {
[self freeMemory: str_c];
|
|
|
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
|
@selector(appendCStringWithoutUTF8Checking:)];
for (j = 0; j < children_count; j++)
append(tmp, @selector(
appendCStringWithoutUTF8Checking:),
[[children_carray[j]
_stringValueWithParentNamespaces: all_namespaces
parentDefaultNamespace: def_ns] cString]);
len += [tmp cStringLength] + [name cStringLength] + 2;
@try {
str_c = [self resizeMemory: str_c
toSize: len];
} @catch (id e) {
[self freeMemory: str_c];
|