-
Notifications
You must be signed in to change notification settings - Fork 0
/
OpalXMLScanner.h
112 lines (75 loc) · 3.49 KB
/
OpalXMLScanner.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//
// OpalXMLScanner.h
// Opal
//
// Created by Christian Niles on 5/4/10.
// Copyright 2010 Christian Niles. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface OpalXMLScanner : NSObject {
NSScanner *scanner;
}
// ===== INITIALIZATION ================================================================================================
- (id)initWithString:(NSString *)xmlString;
+ (OpalXMLScanner *)scannerWithString:(NSString *)xmlString;
// ===== LOCATION ======================================================================================================
- (NSUInteger)scanLocation;
- (NSRange)scanRange;
- (NSString *)xmlString;
- (NSUInteger)remainingChars;
- (BOOL)isAtEnd;
// ===== XML Declaration ===============================================================================================
- (BOOL)isAtXMLDeclaration;
- (NSMutableDictionary *)scanXMLDeclaration;
// ===== START TAGS ====================================================================================================
- (BOOL)isAtStartTag;
- (BOOL)scanStartTagBeginToken;
- (BOOL)scanTagEndToken;
// ===== ATTRIBUTES ====================================================================================================
- (NSString *)scanQuotedValue;
- (NSString *)scanAttributeValue;
- (NSMutableDictionary *)scanAttributes;
- (BOOL)scanAttributeInto:(NSMutableDictionary *)dictionary;
// ===== END TAGS ======================================================================================================
- (BOOL)isAtEndTag;
- (BOOL)scanEndTagBeginToken;
// ===== TEXT ==========================================================================================================
- (BOOL)isAtText;
- (NSString *)scanText;
// ===== REFERENCES ====================================================================================================
- (BOOL)isAtReference;
- (NSString *)scanReference;
- (BOOL)isAtCharacterReference;
- (NSString *)scanCharacterReference;
- (BOOL)isAtHexCharacterReference;
- (NSString *)scanHexCharacterReference;
- (BOOL)isAtDecimalCharacterReference;
- (NSString *)scanDecimalCharacterReference;
- (BOOL)isAtEntityReference;
- (NSString *)scanEntityReference;
+ (NSString *)stringFromUnicodeCharacter:(UInt32)unicodeCharacter;
+ (NSString *)unescapeValue:(NSString *)stringValue;
+ (NSString *)unescapeHexString:(NSString *)hexString;
+ (NSString *)unescapeDecimalString:(NSString *)decimalString;
+ (NSString *)translateEntityReference:(NSString *)entityRef;
+ (NSString *)escapeString:(NSString *)string;
+ (void)escapeStringInline:(NSMutableString *)mutableString;
// ===== CHARACTER DATA ================================================================================================
- (BOOL)isAtCharacterData;
- (NSString *)scanCharacterData;
// ===== WHITESPACE ====================================================================================================
- (BOOL)isAtWhitespace;
- (NSString *)scanWhitespace;
// ===== COMMENTS ======================================================================================================
- (BOOL)isAtComment;
- (NSString *)scanComment;
// ===== SCAN HELPERS ==================================================================================================
- (BOOL)isAtString:(NSString *)matchString;
- (BOOL)matchesRegex:(NSString *)pattern;
- (BOOL)isAtName;
- (NSString *)scanName;
- (BOOL)isAtEquals;
- (NSString *)scanEquals;
- (NSString *)scanRegex:(NSString *)regex;
- (NSString *)scanRegex:(NSString *)regex capture:(NSUInteger)capture;
@end