-
Notifications
You must be signed in to change notification settings - Fork 0
/
TBXmlPListParser.h
executable file
·59 lines (50 loc) · 1.47 KB
/
TBXmlPListParser.h
1
2
3
4
5
6
7
8
9
10
11
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
See Expat.h for license/copyright.
This is a sample xml parser that builds a plist based on the xml document.
See comments below. -tb
*/
#import <Foundation/Foundation.h>
#import <ObjectiveExpat/TBXmlParser.h>
@interface TBXmlPListParser : TBXmlParser
{
NSMutableArray* _stack;
NSMutableDictionary *_plist;
NSMutableString *_cData;
}
-init;
/*
-initWithData:(NSData*)data;
-initWithString:(NSString *)string;
-initWithFile:(NSString *)fileName;
*/
/* these are called by the parser */
-(void)startElement:(NSString*)element withAttributes:(NSDictionary*)attributes;
-(void)endElement:(NSString*)element;
-(void)addCharacterData:(NSString*)data;
/*
-(void)startCDataSection;
-(void)endCDataSection;
-(BOOL)inCDataSection;
*/
/* gives you the plist representation of the xml with character data stored in cdata members */
/* forinstance <foo bar=baz>fooData</foo> turns into {foo = {bar = baz; cdata = fooData; }; } */
/* repeated items are stored in arrays - so for instance
<object class=Gizmo>
<attribute name=thingy>thingyValue</attribute>
<attribute name=doodad>doodadValue</attribute>
</object>
is represented as
{ object =
{ class = Gizmo;
attribute = (
{ name = thingy;
cdata = thingyValue;
},
{ name = doodad;
cdata = doodadValue;
}
);
}
*/
-(NSDictionary*)propertyList;
@end