ObjFW  Check-in [20e7d0c0e2]

Overview
Comment:Make the parser optional for OFMalformedXMLException.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 20e7d0c0e230c493ee07a06c84bb093067428fbf0d58aa6b1861efcc9af29e4b
User & Date: js on 2012-02-03 15:06:14
Other Links: manifest | tags
Context
2012-02-05
14:16
Fix some code that was not converted to new APIs. check-in: 1590be4bbc user: js tags: trunk
2012-02-03
15:06
Make the parser optional for OFMalformedXMLException. check-in: 20e7d0c0e2 user: js tags: trunk
14:20
Add OFXMLProcessingInstructions and let OFXMLElementBuilder create them. check-in: 045aa2e2d5 user: js tags: trunk
Changes

Modified src/OFXMLElementBuilder.m from [134f6deb5b] to [21ba954ddd].

199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
}

- (void)elementBuilder: (OFXMLElementBuilder*)builder
  didNotExpectCloseTag: (OFString*)name
	    withPrefix: (OFString*)prefix
	     namespace: (OFString*)ns
{
	@throw [OFMalformedXMLException exceptionWithClass: [builder class]
						    parser: nil];
}

- (OFString*)elementBuilder: (OFXMLElementBuilder*)builder
    foundUnknownEntityNamed: (OFString*)entity
{
	return nil;
}
@end







|
<








199
200
201
202
203
204
205
206

207
208
209
210
211
212
213
214
}

- (void)elementBuilder: (OFXMLElementBuilder*)builder
  didNotExpectCloseTag: (OFString*)name
	    withPrefix: (OFString*)prefix
	     namespace: (OFString*)ns
{
	@throw [OFMalformedXMLException exceptionWithClass: [builder class]];

}

- (OFString*)elementBuilder: (OFXMLElementBuilder*)builder
    foundUnknownEntityNamed: (OFString*)entity
{
	return nil;
}
@end

Modified src/exceptions/OFMalformedXMLException.m from [f6faac305c] to [b901fc7015].

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
+ exceptionWithClass: (Class)class_
	      parser: (OFXMLParser*)parser
{
	return [[[self alloc] initWithClass: class_
				     parser: parser] autorelease];
}

- initWithClass: (Class)class_
{
	Class c = isa;
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
						    selector: _cmd];
}

- initWithClass: (Class)class_
	 parser: (OFXMLParser*)parser_
{
	self = [super initWithClass: class_];

	parser = [parser_ retain];








<
<
<
<
<
<
<
<







26
27
28
29
30
31
32








33
34
35
36
37
38
39
+ exceptionWithClass: (Class)class_
	      parser: (OFXMLParser*)parser
{
	return [[[self alloc] initWithClass: class_
				     parser: parser] autorelease];
}









- initWithClass: (Class)class_
	 parser: (OFXMLParser*)parser_
{
	self = [super initWithClass: class_];

	parser = [parser_ retain];

56
57
58
59
60
61
62

63
64



65
66
67
68
69
70
71
72
73
}

- (OFString*)description
{
	if (description != nil)
		return description;


	description = [[OFString alloc] initWithFormat:
	    @"The parser in class %@ encountered malformed XML!", inClass];




	return description;
}

- (OFXMLParser*)parser
{
	return parser;
}
@end







>
|
|
>
>
>









48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
}

- (OFString*)description
{
	if (description != nil)
		return description;

	if (parser != nil)
		description = [[OFString alloc] initWithFormat:
		    @"The parser in class %@ encountered malformed XML!",
		    inClass];
	else
		description = @"A parser encountered malformed XML!";

	return description;
}

- (OFXMLParser*)parser
{
	return parser;
}
@end