︙ | | | ︙ | |
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
[OF_XMLPARSER_IN_COMMENT_1] = inCommentState1,
[OF_XMLPARSER_IN_COMMENT_2] = inCommentState2,
[OF_XMLPARSER_IN_DOCTYPE] = inDOCTYPEState
};
static OF_INLINE void
appendToBuffer(OFMutableData *buffer, const char *string,
of_string_encoding_t encoding, size_t length)
{
if OF_LIKELY(encoding == OF_STRING_ENCODING_UTF_8)
[buffer addItems: string count: length];
else {
void *pool = objc_autoreleasePoolPush();
OFString *tmp = [OFString stringWithCString: string
encoding: encoding
length: length];
[buffer addItems: tmp.UTF8String count: tmp.UTF8StringLength];
|
|
|
|
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
[OF_XMLPARSER_IN_COMMENT_1] = inCommentState1,
[OF_XMLPARSER_IN_COMMENT_2] = inCommentState2,
[OF_XMLPARSER_IN_DOCTYPE] = inDOCTYPEState
};
static OF_INLINE void
appendToBuffer(OFMutableData *buffer, const char *string,
OFStringEncoding encoding, size_t length)
{
if OF_LIKELY(encoding == OFStringEncodingUTF8)
[buffer addItems: string count: length];
else {
void *pool = objc_autoreleasePoolPush();
OFString *tmp = [OFString stringWithCString: string
encoding: encoding
length: length];
[buffer addItems: tmp.UTF8String count: tmp.UTF8StringLength];
|
︙ | | | ︙ | |
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
dict = [OFMutableDictionary dictionaryWithKeysAndObjects:
@"xml", @"http://www.w3.org/XML/1998/namespace",
@"xmlns", @"http://www.w3.org/2000/xmlns/", nil];
[_namespaces addObject: dict];
_acceptProlog = true;
_lineNumber = 1;
_encoding = OF_STRING_ENCODING_UTF_8;
_depthLimit = 32;
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
|
|
|
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
dict = [OFMutableDictionary dictionaryWithKeysAndObjects:
@"xml", @"http://www.w3.org/XML/1998/namespace",
@"xmlns", @"http://www.w3.org/2000/xmlns/", nil];
[_namespaces addObject: dict];
_acceptProlog = true;
_lineNumber = 1;
_encoding = OFStringEncodingUTF8;
_depthLimit = 32;
objc_autoreleasePoolPop(pool);
} @catch (id e) {
[self release];
@throw e;
}
|
︙ | | | ︙ | |
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
|
hasVersion = true;
}
if ([attribute isEqual: @"encoding"]) {
@try {
self->_encoding =
of_string_parse_encoding(value);
} @catch (OFInvalidArgumentException *e) {
@throw [OFInvalidEncodingException
exception];
}
}
last = i + 1;
|
|
|
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
|
hasVersion = true;
}
if ([attribute isEqual: @"encoding"]) {
@try {
self->_encoding =
OFParseStringEncodingName(value);
} @catch (OFInvalidArgumentException *e) {
@throw [OFInvalidEncodingException
exception];
}
}
last = i + 1;
|
︙ | | | ︙ | |
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
|
appendToBuffer(self->_buffer, self->_data + self->_last,
self->_encoding, self->_i - self->_last);
PI = transformString(self, self->_buffer, 1, false);
whitespaceCS = [OFCharacterSet
characterSetWithCharactersInString: @" \r\n\r"];
pos = [PI indexOfCharacterFromSet: whitespaceCS];
if (pos != OF_NOT_FOUND) {
target = [PI substringToIndex: pos];
data = [[PI substringFromIndex: pos + 1]
stringByDeletingEnclosingWhitespaces];
if (data.length == 0)
data = nil;
} else
target = PI;
if ([target caseInsensitiveCompare: @"xml"] == OF_ORDERED_SAME)
if (!parseXMLProcessingInstruction(self, data))
@throw [OFMalformedXMLException
exceptionWithParser: self];
if ([self->_delegate respondsToSelector: @selector(
parser:foundProcessingInstructionWithTarget:data:)])
[self->_delegate parser: self
|
|
|
|
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
|
appendToBuffer(self->_buffer, self->_data + self->_last,
self->_encoding, self->_i - self->_last);
PI = transformString(self, self->_buffer, 1, false);
whitespaceCS = [OFCharacterSet
characterSetWithCharactersInString: @" \r\n\r"];
pos = [PI indexOfCharacterFromSet: whitespaceCS];
if (pos != OFNotFound) {
target = [PI substringToIndex: pos];
data = [[PI substringFromIndex: pos + 1]
stringByDeletingEnclosingWhitespaces];
if (data.length == 0)
data = nil;
} else
target = PI;
if ([target caseInsensitiveCompare: @"xml"] == OFOrderedSame)
if (!parseXMLProcessingInstruction(self, data))
@throw [OFMalformedXMLException
exceptionWithParser: self];
if ([self->_delegate respondsToSelector: @selector(
parser:foundProcessingInstructionWithTarget:data:)])
[self->_delegate parser: self
|
︙ | | | ︙ | |