-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExpatXMLParser.h
71 lines (57 loc) · 2.47 KB
/
ExpatXMLParser.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
60
61
62
63
64
65
66
67
68
69
70
71
#import <Foundation/Foundation.h>
#import <zlib.h>
#import "expat.h"
#import <CFNetwork/CFNetwork.h>
@class ExpatXMLParser;
// Delegate Methods
@protocol ExpatXMLParserDelegate <NSObject>
@optional
- (void)parserDidStartDocument:(ExpatXMLParser*)parser;
- (void)parserDidEndDocument:(ExpatXMLParser*)parser;
- (void)parser:(ExpatXMLParser*)parser didStartMappingPrefix:(NSString *)prefix toURI:(NSString *)namespaceURI;
- (void)parser:(ExpatXMLParser*)parser didEndMappingPrefix:(NSString *)prefix;
- (void)parser:(ExpatXMLParser*)parser foundComment:(NSString *)comment;
- (void)parser:(ExpatXMLParser*)parser foundProcessingInstructionWithTarget:(NSString *)target data:(NSString *)data;
- (void)parser:(ExpatXMLParser*)parser parseErrorOccurred:(NSError *)parseError;
- (BOOL)parser:(ExpatXMLParser*)parser shouldProcessAttributesForElement:(NSString *)elementName;
- (void)parser:(ExpatXMLParser*)parser shouldBeginHTTPRequest:(CFHTTPMessageRef)httpMessage;
@required
- (void)parser:(ExpatXMLParser*)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict;
- (void)parser:(ExpatXMLParser*)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName;
- (void)parser:(ExpatXMLParser *)parser foundCharacters:(NSString *)string;
@end
@interface ExpatXMLParser : NSObject
{
id<ExpatXMLParserDelegate> delegate;
BOOL shouldProcessNamespaces;
BOOL shouldReportNamespacePrefixes;
BOOL shouldResolveExternalEntities;
BOOL _isDataParse;
CFMutableDictionaryRef dict;
CFMutableStringRef buffer;
XML_Parser parser;
NSURL * url;
NSError *error;
CFStringRef seperator;
NSData * data;
NSString * userAgent;
}
- (id)initWithContentsOfURL:(NSURL *)url;
- (id)initWithContentsOfFile:(NSString *)path;
- (id)initWithData:(NSData *)data; // create the parser from data
@property(nonatomic, retain) id<ExpatXMLParserDelegate> delegate;
@property(nonatomic, retain) NSString * userAgent;
- (void)setShouldProcessNamespaces:(BOOL)shouldProcessNamespaces;
- (BOOL)shouldProcessNamespaces;
- (void)setShouldReportNamespacePrefixes:(BOOL)flag;
- (BOOL)shouldReportNamespacePrefixes;
- (void)setShouldResolveExternalEntities:(BOOL)shouldResolveExternalEntities;
- (BOOL)shouldResolveExternalEntities;
- (BOOL)parse;
- (void)abortParsing;
- (NSError *)parserError;
- (int)columnNumber;
- (int)lineNumber;
- (NSString *)publicID;
- (NSString *)systemID;
@end