12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFXMLElementBuilder.h"
#import "OFXMLElement.h"
#import "OFXMLAttribute.h"
#import "OFXMLCharacters.h"
#import "OFXMLCDATA.h"
#import "OFXMLComment.h"
#import "OFXMLProcessingInstructions.h"
#import "OFXMLParser.h"
#import "OFArray.h"
#import "OFMalformedXMLException.h"
@implementation OFXMLElementBuilder
@synthesize delegate = _delegate;
+ (instancetype)elementBuilder
{
return [[[self alloc] init] autorelease];
}
- (instancetype)init
{
self = [super init];
|
|
|
|
|
|
|
|
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFXMLElementBuilder.h"
#import "OFArray.h"
#import "OFXMLAttribute.h"
#import "OFXMLCDATA.h"
#import "OFXMLCharacters.h"
#import "OFXMLComment.h"
#import "OFXMLElement.h"
#import "OFXMLParser.h"
#import "OFXMLProcessingInstruction.h"
#import "OFMalformedXMLException.h"
@implementation OFXMLElementBuilder
@synthesize delegate = _delegate;
+ (instancetype)builder
{
return [[[self alloc] init] autorelease];
}
- (instancetype)init
{
self = [super init];
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
- (void)dealloc
{
[_stack release];
[super dealloc];
}
- (void)parser: (OFXMLParser *)parser
foundProcessingInstructions: (OFString *)pi
{
OFXMLProcessingInstructions *node = [OFXMLProcessingInstructions
processingInstructionsWithString: pi];
OFXMLElement *parent = _stack.lastObject;
if (parent != nil)
[parent addChild: node];
else if ([_delegate respondsToSelector:
@selector(elementBuilder:didBuildParentlessNode:)])
[_delegate elementBuilder: self didBuildParentlessNode: node];
|
|
|
>
|
|
>
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
- (void)dealloc
{
[_stack release];
[super dealloc];
}
- (void)parser: (OFXMLParser *)parser
foundProcessingInstructionWithTarget: (OFString *)target
data: (OFString *)data
{
OFXMLProcessingInstruction *node = [OFXMLProcessingInstruction
processingInstructionWithTarget: target
data: data];
OFXMLElement *parent = _stack.lastObject;
if (parent != nil)
[parent addChild: node];
else if ([_delegate respondsToSelector:
@selector(elementBuilder:didBuildParentlessNode:)])
[_delegate elementBuilder: self didBuildParentlessNode: node];
|
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
@selector(elementBuilder:didBuildParentlessNode:)])
[_delegate elementBuilder: self didBuildParentlessNode: node];
}
- (void)parser: (OFXMLParser *)parser
foundComment: (OFString *)comment
{
OFXMLComment *node = [OFXMLComment commentWithString: comment];
OFXMLElement *parent = _stack.lastObject;
if (parent != nil)
[parent addChild: node];
else if ([_delegate respondsToSelector:
@selector(elementBuilder:didBuildParentlessNode:)])
[_delegate elementBuilder: self didBuildParentlessNode: node];
|
|
|
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
@selector(elementBuilder:didBuildParentlessNode:)])
[_delegate elementBuilder: self didBuildParentlessNode: node];
}
- (void)parser: (OFXMLParser *)parser
foundComment: (OFString *)comment
{
OFXMLComment *node = [OFXMLComment commentWithText: comment];
OFXMLElement *parent = _stack.lastObject;
if (parent != nil)
[parent addChild: node];
else if ([_delegate respondsToSelector:
@selector(elementBuilder:didBuildParentlessNode:)])
[_delegate elementBuilder: self didBuildParentlessNode: node];
|