Overview
Context
Changes
Modified src/OFXMLElement.h
from [817f97f00f]
to [a8bd3c93ce].
︙ | | |
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
+
|
OF_ASSUME_NONNULL_BEGIN
@class OFArray OF_GENERIC(ObjectType);
@class OFMutableArray OF_GENERIC(ObjectType);
@class OFMutableDictionary OF_GENERIC(KeyType, ObjectType);
@class OFMutableString;
@class OFStream;
@class OFString;
@class OFXMLAttribute;
/**
* @class OFXMLElement OFXMLElement.h ObjFW/OFXMLElement.h
*
* @brief A class which stores an XML element.
|
︙ | | |
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
-
-
+
-
+
-
+
-
+
-
|
* @brief Parses the string and returns an OFXMLElement for it.
*
* @param string The string to parse
* @return A new autoreleased OFXMLElement with the contents of the string
*/
+ (instancetype)elementWithXMLString: (OFString *)string;
#ifdef OF_HAVE_FILES
/**
* @brief Parses the specified file and returns an OFXMLElement for it.
* @brief Parses the specified stream and returns an OFXMLElement for it.
*
* @param path The path to the file
* @param stream The stream to parse
* @return A new autoreleased OFXMLElement with the contents of the specified
* file
* stream
*/
+ (instancetype)elementWithFile: (OFString *)path;
+ (instancetype)elementWithStream: (OFStream *)stream;
#endif
- (instancetype)init OF_UNAVAILABLE;
/**
* @brief Initializes an already allocated OFXMLElement with the specified name.
*
* @param name The name for the element
|
︙ | | |
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
-
-
+
-
-
+
+
-
+
-
|
* with it.
*
* @param string The string to parse
* @return An initialized OFXMLElement with the contents of the string
*/
- (instancetype)initWithXMLString: (OFString *)string;
#ifdef OF_HAVE_FILES
/**
* @brief Parses the specified file and initializes an already allocated
* @brief Parses the specified stream and initializes an already allocated
* OFXMLElement with it.
*
* @param path The path to the file
* @return An initialized OFXMLElement with the contents of the specified file
* @param stream The stream to parse
* @return An initialized OFXMLElement with the contents of the specified stream
*/
- (instancetype)initWithFile: (OFString *)path;
- (instancetype)initWithStream: (OFStream *)stream;
#endif
- (instancetype)initWithSerialization: (OFXMLElement *)element;
/**
* @brief Sets a prefix for a namespace.
*
* @param prefix The prefix for the namespace
|
︙ | | |
Modified src/OFXMLElement.m
from [c47060e7f9]
to [47bfb07248].
︙ | | |
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
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
|
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
|
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#import "OFXMLElement.h"
#import "OFXMLNode+Private.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFData.h"
#import "OFArray.h"
#import "OFData.h"
#import "OFDictionary.h"
#import "OFStream.h"
#import "OFString.h"
#import "OFXMLAttribute.h"
#import "OFXMLCDATA.h"
#import "OFXMLCharacters.h"
#import "OFXMLCDATA.h"
#import "OFXMLParser.h"
#import "OFXMLElementBuilder.h"
#import "OFXMLElementBuilder.h"
#import "OFXMLNode+Private.h"
#import "OFXMLParser.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFMalformedXMLException.h"
#import "OFUnboundNamespaceException.h"
/* References for static linking */
|
︙ | | |
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
-
-
+
-
+
-
|
}
+ (instancetype)elementWithXMLString: (OFString *)string
{
return [[[self alloc] initWithXMLString: string] autorelease];
}
#ifdef OF_HAVE_FILES
+ (instancetype)elementWithFile: (OFString *)path
+ (instancetype)elementWithStream: (OFStream *)stream
{
return [[[self alloc] initWithFile: path] autorelease];
return [[[self alloc] initWithStream: stream] autorelease];
}
#endif
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithName: (OFString *)name
|
︙ | | |
230
231
232
233
234
235
236
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
|
229
230
231
232
233
234
235
236
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
|
-
-
+
-
+
-
|
self = [delegate->_element retain];
objc_autoreleasePoolPop(pool);
return self;
}
#ifdef OF_HAVE_FILES
- (instancetype)initWithFile: (OFString *)path
- (instancetype)initWithStream: (OFStream *)stream
{
void *pool;
OFXMLParser *parser;
OFXMLElementBuilder *builder;
OFXMLElementElementBuilderDelegate *delegate;
[self release];
pool = objc_autoreleasePoolPush();
parser = [OFXMLParser parser];
builder = [OFXMLElementBuilder elementBuilder];
delegate = [[[OFXMLElementElementBuilderDelegate alloc] init]
autorelease];
parser.delegate = builder;
builder.delegate = delegate;
[parser parseFile: path];
[parser parseStream: stream];
if (!parser.hasFinishedParsing)
@throw [OFMalformedXMLException exceptionWithParser: parser];
self = [delegate->_element retain];
objc_autoreleasePoolPop(pool);
return self;
}
#endif
- (instancetype)initWithSerialization: (OFXMLElement *)element
{
self = [super of_init];
@try {
void *pool = objc_autoreleasePoolPush();
|
︙ | | |
Modified src/OFXMLParser.h
from [9632092363]
to [6159c08e1a].
︙ | | |
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
224
225
226
227
228
229
230
231
232
233
|
-
-
-
-
-
-
-
-
-
|
/**
* @brief Parses the specified stream.
*
* @param stream The stream to parse
*/
- (void)parseStream: (OFStream *)stream;
#ifdef OF_HAVE_FILES
/**
* @brief Parses the specified file.
*
* @param path The path to the file to parse
*/
- (void)parseFile: (OFString *)path;
#endif
@end
OF_ASSUME_NONNULL_END
|
Modified src/OFXMLParser.m
from [a0e17680fe]
to [495894cd91].
︙ | | |
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
|
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
-
-
-
-
-
-
-
-
-
-
-
-
-
|
length: length];
}
} @finally {
free(buffer);
}
}
#ifdef OF_HAVE_FILES
- (void)parseFile: (OFString *)path
{
OFFile *file = [[OFFile alloc] initWithPath: path
mode: @"r"];
@try {
[self parseStream: file];
} @finally {
[file release];
}
}
#endif
static void
inByteOrderMarkState(OFXMLParser *self)
{
if (self->_data[self->_i] != "\xEF\xBB\xBF"[self->_level]) {
if (self->_level == 0) {
self->_state = OF_XMLPARSER_OUTSIDE_TAG;
self->_i--;
|
︙ | | |