484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
|
- (double)doubleValue
{
return [[self stringValue] doubleValue];
}
- (OFString*)_XMLStringWithParent: (OFXMLElement*)parent
indentation: (unsigned int)indentation
level: (size_t)level
{
OFAutoreleasePool *pool, *pool2;
char *cString;
size_t length, i, j, attributesCount;
OFString *prefix, *parentPrefix;
OFXMLAttribute **attributesCArray;
OFString *ret;
OFMutableDictionary *allNamespaces;
OFString *defaultNS;
if (characters != nil)
return [characters stringByXMLEscaping];
if (CDATA != nil)
return [OFString stringWithFormat: @"<![CDATA[%@]]>", CDATA];
|
>
<
|
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
|
- (double)doubleValue
{
return [[self stringValue] doubleValue];
}
- (OFString*)_XMLStringWithParent: (OFXMLElement*)parent
namespaces: (OFDictionary*)allNamespaces
indentation: (unsigned int)indentation
level: (size_t)level
{
OFAutoreleasePool *pool, *pool2;
char *cString;
size_t length, i, j, attributesCount;
OFString *prefix, *parentPrefix;
OFXMLAttribute **attributesCArray;
OFString *ret;
OFString *defaultNS;
if (characters != nil)
return [characters stringByXMLEscaping];
if (CDATA != nil)
return [OFString stringWithFormat: @"<![CDATA[%@]]>", CDATA];
|
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
|
comment];
return ret;
}
pool = [[OFAutoreleasePool alloc] init];
if (parent != nil && parent->namespaces != nil) {
OFEnumerator *keyEnumerator = [namespaces keyEnumerator];
OFEnumerator *objectEnumerator = [namespaces objectEnumerator];
id key, object;
allNamespaces = [[parent->namespaces mutableCopy] autorelease];
while ((key = [keyEnumerator nextObject]) != nil &&
(object = [objectEnumerator nextObject]) != nil)
[allNamespaces setObject: object
forKey: key];
} else
allNamespaces = namespaces;
prefix = [allNamespaces objectForKey:
(ns != nil ? ns : (OFString*)@"")];
parentPrefix = [allNamespaces objectForKey:
(parent != nil && parent->ns != nil ? parent->ns : (OFString*)@"")];
if (parent != nil && parent->ns != nil && parentPrefix == nil)
defaultNS = parent->ns;
else if (parent != nil && parent->defaultNamespace != nil)
defaultNS = parent->defaultNamespace;
else
defaultNS = defaultNamespace;
|
>
|
>
>
>
>
|
|
|
>
>
<
<
|
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
|
comment];
return ret;
}
pool = [[OFAutoreleasePool alloc] init];
parentPrefix = [allNamespaces objectForKey:
(parent != nil && parent->ns != nil ? parent->ns : (OFString*)@"")];
/* Add the namespaces of the current element */
if (allNamespaces != nil) {
OFEnumerator *keyEnumerator = [namespaces keyEnumerator];
OFEnumerator *objectEnumerator = [namespaces objectEnumerator];
OFMutableDictionary *tmp;
id key, object;
tmp = [[allNamespaces mutableCopy] autorelease];
while ((key = [keyEnumerator nextObject]) != nil &&
(object = [objectEnumerator nextObject]) != nil)
[tmp setObject: object
forKey: key];
allNamespaces = tmp;
} else
allNamespaces = namespaces;
prefix = [allNamespaces objectForKey:
(ns != nil ? ns : (OFString*)@"")];
if (parent != nil && parent->ns != nil && parentPrefix == nil)
defaultNS = parent->ns;
else if (parent != nil && parent->defaultNamespace != nil)
defaultNS = parent->defaultNamespace;
else
defaultNS = defaultNamespace;
|
676
677
678
679
680
681
682
683
684
685
686
687
688
689
|
OFString *child;
if (indent)
[tmp addItem: "\n"];
child = [childrenCArray[j]
_XMLStringWithParent: self
indentation: (indent ? indentation : 0)
level: level + 1];
[tmp addNItems: [child cStringLength]
fromCArray: [child cString]];
}
|
>
|
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
|
OFString *child;
if (indent)
[tmp addItem: "\n"];
child = [childrenCArray[j]
_XMLStringWithParent: self
namespaces: allNamespaces
indentation: (indent ? indentation : 0)
level: level + 1];
[tmp addNItems: [child cStringLength]
fromCArray: [child cString]];
}
|
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
|
}
return ret;
}
- (OFString*)XMLString
{
return [self _XMLStringWithParent: nil
indentation: 0
level: 0];
}
- (OFString*)XMLStringWithIndentation: (unsigned int)indentation
{
return [self _XMLStringWithParent: nil
indentation: indentation
level: 0];
}
- (OFString*)description
{
return [self XMLStringWithIndentation: 2];
|
>
>
|
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
|
}
return ret;
}
- (OFString*)XMLString
{
return [self _XMLStringWithParent: nil
namespaces: nil
indentation: 0
level: 0];
}
- (OFString*)XMLStringWithIndentation: (unsigned int)indentation
{
return [self _XMLStringWithParent: nil
namespaces: nil
indentation: indentation
level: 0];
}
- (OFString*)description
{
return [self XMLStringWithIndentation: 2];
|