18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#include <string.h>
#import "OFXMLParser.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFBigDataArray.h"
#import "OFXMLAttribute.h"
#import "OFStream.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
#endif
#import "OFSystemInfo.h"
#import "OFInitializationFailedException.h"
#import "OFInvalidFormatException.h"
#import "OFMalformedXMLException.h"
#import "OFOutOfRangeException.h"
#import "OFUnboundPrefixException.h"
typedef void (*state_function_t)(id, SEL);
static SEL selectors[OF_XMLPARSER_NUM_STATES];
static state_function_t lookupTable[OF_XMLPARSER_NUM_STATES];
static OF_INLINE void
appendToBuffer(OFDataArray *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]];
objc_autoreleasePoolPop(pool);
}
}
static OFString *
transformString(OFXMLParser *parser, OFDataArray *buffer, size_t cut,
bool unescape)
{
char *items = [buffer items];
size_t length = [buffer count] - cut;
bool hasEntities = false;
OFString *ret;
|
|
|
|
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#include <string.h>
#import "OFXMLParser.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFData.h"
#import "OFXMLAttribute.h"
#import "OFStream.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
#endif
#import "OFSystemInfo.h"
#import "OFInitializationFailedException.h"
#import "OFInvalidFormatException.h"
#import "OFMalformedXMLException.h"
#import "OFOutOfRangeException.h"
#import "OFUnboundPrefixException.h"
typedef void (*state_function_t)(id, SEL);
static SEL selectors[OF_XMLPARSER_NUM_STATES];
static state_function_t lookupTable[OF_XMLPARSER_NUM_STATES];
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]];
objc_autoreleasePoolPop(pool);
}
}
static OFString *
transformString(OFXMLParser *parser, OFMutableData *buffer, size_t cut,
bool unescape)
{
char *items = [buffer items];
size_t length = [buffer count] - cut;
bool hasEntities = false;
OFString *ret;
|
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
{
self = [super init];
@try {
void *pool;
OFMutableDictionary *dict;
_buffer = [[OFBigDataArray alloc] init];
_previous = [[OFMutableArray alloc] init];
_namespaces = [[OFMutableArray alloc] init];
_attributes = [[OFMutableArray alloc] init];
pool = objc_autoreleasePoolPush();
dict = [OFMutableDictionary dictionaryWithKeysAndObjects:
@"xml", @"http://www.w3.org/XML/1998/namespace",
|
|
|
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
{
self = [super init];
@try {
void *pool;
OFMutableDictionary *dict;
_buffer = [[OFMutableData alloc] init];
_previous = [[OFMutableArray alloc] init];
_namespaces = [[OFMutableArray alloc] init];
_attributes = [[OFMutableArray alloc] init];
pool = objc_autoreleasePoolPush();
dict = [OFMutableDictionary dictionaryWithKeysAndObjects:
@"xml", @"http://www.w3.org/XML/1998/namespace",
|