ObjFW  Diff

Differences From Artifact [fb50bb7b18]:

To Artifact [a53bbdbeea]:


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
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 "OFArray.h"
#import "OFXMLAttribute.h"
#import "OFXMLCharacters.h"
#import "OFXMLCDATA.h"
#import "OFXMLCDATA.h"
#import "OFXMLCharacters.h"
#import "OFXMLComment.h"
#import "OFXMLProcessingInstructions.h"
#import "OFXMLElement.h"
#import "OFXMLParser.h"
#import "OFArray.h"
#import "OFXMLProcessingInstruction.h"

#import "OFMalformedXMLException.h"

@implementation OFXMLElementBuilder
@synthesize delegate = _delegate;

+ (instancetype)elementBuilder
+ (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
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
  foundProcessingInstructions: (OFString *)pi
-			  (void)parser: (OFXMLParser *)parser
  foundProcessingInstructionWithTarget: (OFString *)target
				  data: (OFString *)data
{
	OFXMLProcessingInstructions *node = [OFXMLProcessingInstructions
	    processingInstructionsWithString: pi];
	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
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 commentWithString: 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];