Overview
Context
Changes
Modified src/OFXMLElement.m
from [09fc7f39d0]
to [0f84ad0d19].
︙ | | |
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
|
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
|
-
+
-
|
- (OFString*)OF_XMLStringWithParent: (OFXMLElement*)parent
namespaces: (OFDictionary*)allNamespaces
indentation: (unsigned int)indentation
level: (unsigned int)level
{
void *pool;
char *cString;
size_t length, i, attributesCount;
size_t length, i;
OFString *prefix, *parentPrefix;
OFXMLAttribute *const *attributesObjects;
OFString *ret;
OFString *defaultNS;
pool = objc_autoreleasePoolPush();
parentPrefix = [allNamespaces objectForKey:
(parent != nil && parent->_namespace != nil
|
︙ | | |
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
|
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
|
-
-
-
+
-
-
+
-
+
-
-
+
-
+
-
+
-
|
memcpy(cString + i, [_namespace UTF8String],
[_namespace UTF8StringLength]);
i += [_namespace UTF8StringLength];
cString[i++] = '\'';
}
/* Attributes */
attributesObjects = [_attributes objects];
attributesCount = [_attributes count];
for (OFXMLAttribute *attribute in _attributes) {
for (size_t j = 0; j < attributesCount; j++) {
void *pool2 = objc_autoreleasePoolPush();
OFString *attributeName = [attributesObjects[j] name];
OFString *attributeName = [attribute name];
OFString *attributePrefix = nil;
OFString *tmp =
OFString *tmp = [[attribute stringValue] stringByXMLEscaping];
[[attributesObjects[j] stringValue] stringByXMLEscaping];
if ([attributesObjects[j] namespace] != nil &&
if ([attribute namespace] != nil &&
(attributePrefix = [allNamespaces objectForKey:
[attributesObjects[j] namespace]]) == nil)
[attribute namespace]]) == nil)
@throw [OFUnboundNamespaceException
exceptionWithNamespace: [attributesObjects[j]
exceptionWithNamespace: [attribute namespace]
namespace]
element: self];
length += [attributeName UTF8StringLength] +
(attributePrefix != nil ?
[attributePrefix UTF8StringLength] + 1 : 0) +
[tmp UTF8StringLength] + 4;
|
︙ | | |
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
|
560
561
562
563
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
|
-
-
-
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
-
+
-
-
+
+
|
cString[i++] = '\'';
objc_autoreleasePoolPop(pool2);
}
/* Childen */
if (_children != nil) {
OFXMLNode *const *childrenObjects = [_children objects];
size_t childrenCount = [_children count];
OFDataArray *tmp = [OFDataArray dataArray];
bool indent;
if (indentation > 0) {
indent = true;
for (size_t j = 0; j < childrenCount; j++) {
if ([childrenObjects[j] isKindOfClass:
charactersClass] || [childrenObjects[j]
isKindOfClass: CDATAClass]) {
for (OFXMLNode *child in _children) {
if ([child isKindOfClass: charactersClass] ||
[child isKindOfClass: CDATAClass]) {
indent = false;
break;
}
}
} else
indent = false;
for (size_t j = 0; j < childrenCount; j++) {
OFString *child;
for (OFXMLNode *child in _children) {
OFString *childString;
unsigned int ind = (indent ? indentation : 0);
if (ind)
[tmp addItem: "\n"];
if ([childrenObjects[j] isKindOfClass:
[OFXMLElement class]])
child = [(OFXMLElement*)childrenObjects[j]
if ([child isKindOfClass: [OFXMLElement class]])
childString = [(OFXMLElement*)child
OF_XMLStringWithParent: self
namespaces: allNamespaces
indentation: ind
level: level + 1];
else
child = [childrenObjects[j]
childString = [child
XMLStringWithIndentation: ind
level: level + 1];
[tmp addItems: [child UTF8String]
count: [child UTF8StringLength]];
[tmp addItems: [childString UTF8String]
count: [childString UTF8StringLength]];
}
if (indent)
[tmp addItem: "\n"];
length += [tmp count] + [_name UTF8StringLength] + 2 +
(indent ? level * indentation : 0);
|
︙ | | |