RSSKit 0.6.1
DOMParser.h
1/* -*-objc-*-
2 *
3 * GNUstep RSS Kit
4 * Copyright (C) 2006 Guenther Noack
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation, in version 2.1
9 * of the License
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#import <Foundation/Foundation.h>
22
23@class XMLNode;
24
25@protocol XMLTextOrNode <NSObject>
26-(NSString*) contentAndNextContents;
27-(NSString*) content;
28-(void) _setNext: (id<XMLTextOrNode>) node;
29-(XMLNode*) nextElement;
30@end
31
32@interface XMLText : NSObject <XMLTextOrNode>
33{
34 NSString* _content;
35 id<XMLTextOrNode> _next;
36}
37
38-(NSString*) contentAndNextContents;
39-(NSString*) content;
40-(void) _setNext: (id<XMLTextOrNode>) node;
41-(XMLNode*) nextElement;
42
43-(id)init;
44-(id)initWithString: (NSString*) str;
45
46-(void)dealloc;
47@end
48
49
50@interface XMLNode : NSObject <XMLTextOrNode>
51{
52 NSString* _name;
53 NSString* _namespace;
54
55 XMLNode* _child;
56 id<XMLTextOrNode> _next;
57
58 id<XMLTextOrNode> _current;
59 XMLNode* _parent;
60
61 NSDictionary* _attributes;
62}
63
64-(XMLNode*) firstChildElement;
65
66-(XMLNode*) nextElement;
67
68-(NSString*) name;
69
70-(NSString*) contentAndNextContents;
71-(NSString*) content;
72
73-(NSDictionary*) attributes;
74
75-(NSString*) namespace;
76
77-(id) initWithName: (NSString*) name
78 namespace: (NSString*) namespace
79 attributes: (NSDictionary*) attributes
80 parent: (XMLNode*) parent;
81
82-(void) dealloc;
83
84- (void) _setNext: (id <XMLTextOrNode>) node;
85
86- (void) appendTextOrNode: (id<XMLTextOrNode>) aThing
87 fromParser: (NSXMLParser*) aParser;
88
89@end
90
91@interface XMLNode (NSXMLParserDelegateEventAdditions)
92- (void) parser: (NSXMLParser*)aParser
93 didEndElement: (NSString*)anElementName
94 namespaceURI: (NSString*)aNamespaceURI
95 qualifiedName: (NSString*)aQualifierName;
96
97- (void) parser: (NSXMLParser*)aParser
98didStartElement: (NSString*)anElementName
99 namespaceURI: (NSString*)aNamespaceURI
100 qualifiedName: (NSString*)aQualifierName
101 attributes: (NSDictionary*)anAttributeDict;
102
103- (void) parser: (NSXMLParser*)aParser
104 parseErrorOccured: (NSError*)parseError;
105
106- (void) parser: (NSXMLParser*)aParser
107foundCharacters: (NSString*)aString;
108
109- (void) parser: (NSXMLParser*)aParser
110 foundCDATA: (NSData*)CDATABlock;
111@end