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
70
71
72
73
74
75
76
77
|
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
70
71
72
73
74
75
76
77
78
79
80
81
82
|
+
+
+
+
+
|
/**
* A protocol that needs to be implemented by delegates for OFXMLParser.
*/
@protocol OFXMLParserDelegate
/**
* This callback is called when the XML parser found the start of a new tag.
*
* \param parser The parser which found a new tag
* \param name The name of the tag which just started
* \param prefix The prefix of the tag which just started or nil
* \param ns The namespace of the tag which just started or nil
* \param attrs The attributes included in the tag which just started or nil
*/
- (void)xmlParser: (OFXMLParser*)parser
didStartTagWithName: (OFString*)name
prefix: (OFString*)prefix
namespace: (OFString*)ns
attributes: (OFArray*)attrs;
/**
* This callback is called when the XML parser found the end of a tag.
*
* \param parser The parser which found the end of a tag
* \param name The name of the tag which just ended
* \param prefix The prefix of the tag which just ended or nil
* \param ns The namespace of the tag which just ended or nil
*/
- (void)xmlParser: (OFXMLParser*)parser
didEndTagWithName: (OFString*)name
prefix: (OFString*)prefix
namespace: (OFString*)ns;
/**
* This callback is called when the XML parser found a string.
*
* \param parser The parser which found a string
* \param string The string the XML parser found
*/
- (void)xmlParser: (OFXMLParser*)parser
foundString: (OFString*)string;
/**
* This callback is called when the XML parser found a comment.
*
* \param parser The parser which found a comment
* \param comment The comment the XML parser found
*/
- (void)xmlParser: (OFXMLParser*)parser
foundComment: (OFString*)comment;
/**
* This callback is called when the XML parser found an entity it doesn't know.
* The callback is supposed to return a substitution for the entity or nil if
* it is not known to the callback as well, in which case an exception will be
* risen.
*
* \param parser The parser which found an unknown entity
* \param entity The name of the entity the XML parser didn't know
* \return A substitution for the entity or nil
*/
- (OFString*)xmlParser: (OFXMLParser*)parser
foundUnknownEntityNamed: (OFString*)entity;
@end
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
-
+
|
* unescape XML. The callback is supposed to return a substitution for the
* entity or nil if it is not known to the callback as well, in which case an
* exception will be risen.
*
* \param entity The name of the entity that is unknown
* \return A substitution for the entity or nil
*/
- (OFString*)foundUnknownEntityNamed: (OFString*)entitiy;
- (OFString*)foundUnknownEntityNamed: (OFString*)entity;
@end
/**
* An event-based XML parser which calls the delegate's callbacks as soon as
* it finds something, thus suitable for streams as well.
*/
@interface OFXMLParser: OFObject <OFXMLUnescapingDelegate>
|