-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBCXMLDocumentParser.h
More file actions
64 lines (39 loc) · 1.52 KB
/
BCXMLDocumentParser.h
File metadata and controls
64 lines (39 loc) · 1.52 KB
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
60
61
62
63
64
//
// BCXMLDocumentParser.h
// Caravan
//
// Created by Tom Houpt on 16/6/2.
// Copyright © 2016 Tom Houpt. All rights reserved.
//
/** BCXMLDocumentParser
Usage: need to define a list of expected Element keys and Array Element keys
in the private methods
-(BOOL)isNameOfDictionaryElement:(NSString *)elementName;
-(BOOL)isNameOfArrayElement:(NSString *)elementName;
kBCXMLDocumentParserCompletionNotification will be posted when NSXML parser is done parsing
the XML document is placed in a dictionary accessed via [BCXMLDocumentParser xmlDictionary]
for example:
-(void)startParser:(NSData *)xmlData {
BCXMLDocumentParser *parser = [BCXMLDocumentParser alloc] initWithData:(NSData *)xmlData];
[defaultCenter addObserver:self
selector:@selector(parserCompleted:)
name:kBCXMLDocumentParserCompletionNotification object:nil];
}
-(void)parserCompleted:(NSNotification *)note; {
BCXMLDocumentParser * parser= note.object;
BCXMLElement *keggPathway = [parser xmlDictionary];
}
*/
#import <Foundation/Foundation.h>
#define kBCXMLDocumentParserCompletionNotification @"BCXMLDocumentParserCompletionNotification"
@class BCXMLElement;
@interface BCXMLDocumentParser : NSObject <NSXMLParserDelegate>
@property NSMutableArray *containerStack;
@property NSMutableString *currentStringValue;
@property NSXMLParser *xmlParser;
@property BOOL parseCompleted;
-(id)initWithData:(NSData *)xmlData;
/** dictionary compiled from xml
*/
-(BCXMLElement *)xmlDictionary;
@end