├── .gitignore
├── README.markdown
├── TBXML-Code
├── TBXML+Compression.m
├── TBXML+HTTP.m
└── TBXML.m
├── TBXML-Headers
├── TBXML+Compression.h
├── TBXML+HTTP.h
└── TBXML.h
├── TBXML-Support
├── TBXML-Prefix.pch
└── TBXML-iOS-Prefix.pch
├── TBXML-Tests
├── Supporting Files
│ ├── InfoPlist.strings
│ ├── TBXMLTests-Info.plist
│ └── books.xml
├── TBXMLTests.h
└── TBXMLTests.m
└── TBXML.xcodeproj
└── project.pbxproj
/.gitignore:
--------------------------------------------------------------------------------
1 | # Mac OS X
2 | *.DS_Store
3 |
4 | # Xcode
5 | *.pbxuser
6 | *.mode1v3
7 | *.mode2v3
8 | *.perspectivev3
9 | *.xcuserstate
10 | project.xcworkspace
11 | xcuserdata
12 |
13 |
--------------------------------------------------------------------------------
/README.markdown:
--------------------------------------------------------------------------------
1 | ### What is TBXML
2 |
3 | TBXML is a light-weight XML document parser written in Objective-C designed for use on Apple iPad, iPhone & iPod Touch devices (also Mac OSX compatible). TBXML aims to provide the fastest possible XML parsing whilst utilising the fewest resources. This requirement for absolute efficiency is achieved at the expense of XML validation and modification. It is not possible to modify and generate valid XML from a TBXML object and no validation is performed whatsoever whilst importing and parsing an XML document.
4 |
5 | ### Performance
6 |
7 | TBXML is incredibly fast! Check out this post for a good comparison of XML parsers. [How To Chose The Best XML Parser for Your iPhone Project](http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project "How To Chose The Best XML Parser for Your iPhone Project")
8 |
9 | ### Design Goals
10 |
11 | * XML files conforming to the W3C XML spec 1.0 should be passable
12 | * XML parsing should incur the fewest possible resources
13 | * XML parsing should be achieved in the shortest possible time
14 | * It shall be easy to write programs that utilise TBXML
15 |
16 | ### What Now?
17 |
18 | Have a play with the [TBXML-Books](https://github.com/71squared/TBXML-Books) sample project
19 |
20 | View the "TBXML" wiki page to get find out how TBXML works. It contains many examples showing you how to use TBXML to parse your XML files. There are 2 complementary additions to extend the functionality of TBXML. These add the ability to automatically decompress files and perform asynchronous HTTP requests.
21 |
22 | [TBXML](https://github.com/71squared/TBXML/wiki/TBXML)
23 | [TBXML+Compression](https://github.com/71squared/TBXML/wiki/TBXML+Compression)
24 | [TBXML+HTTP](https://github.com/71squared/TBXML/wiki/TBXML+HTTP)
25 |
26 |
27 |
28 | Love the project? Wanna buy me a coffee? [](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9629667)
29 |
30 |
31 |
32 |
33 |
34 | ### MIT License
35 | Copyright 2012 71Squared All rights reserved.
36 |
37 | Permission is hereby granted, free of charge, to any person obtaining a copy
38 | of this software and associated documentation files (the "Software"), to deal
39 | in the Software without restriction, including without limitation the rights
40 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
41 | copies of the Software, and to permit persons to whom the Software is
42 | furnished to do so, subject to the following conditions:
43 |
44 | The above copyright notice and this permission notice shall be included in
45 | all copies or substantial portions of the Software.
46 |
47 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
49 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
50 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
51 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
52 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
53 | THE SOFTWARE.
--------------------------------------------------------------------------------
/TBXML-Code/TBXML+Compression.m:
--------------------------------------------------------------------------------
1 |
2 | #import "TBXML+Compression.h"
3 | #import
4 |
5 |
6 | @implementation NSData (TBXML_Compression)
7 |
8 | // ================================================================================================
9 | // Created by Tom Bradley on 21/10/2009.
10 | // Version 1.5
11 | //
12 | // Copyright 2012 71Squared All rights reserved.
13 | //
14 | // Permission is hereby granted, free of charge, to any person obtaining a copy
15 | // of this software and associated documentation files (the "Software"), to deal
16 | // in the Software without restriction, including without limitation the rights
17 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18 | // copies of the Software, and to permit persons to whom the Software is
19 | // furnished to do so, subject to the following conditions:
20 | //
21 | // The above copyright notice and this permission notice shall be included in
22 | // all copies or substantial portions of the Software.
23 | //
24 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30 | // THE SOFTWARE.
31 | // ================================================================================================
32 |
33 | + (NSData *) dataWithUncompressedContentsOfFile:(NSString *)aFile {
34 |
35 | NSData * result;
36 |
37 | if ([[aFile pathExtension] isEqualToString:@"gz"]) {
38 | NSData * compressedData = [NSData dataWithContentsOfFile:aFile];
39 | result = [compressedData gzipInflate];
40 | }
41 | else
42 | result = [NSData dataWithContentsOfFile:aFile];
43 |
44 | return result;
45 | }
46 |
47 |
48 |
49 |
50 |
51 | // ================================================================================================
52 | // base64.m
53 | // ViewTransitions
54 | //
55 | // Created by Neo on 5/11/08.
56 | // Copyright 2008 Kaliware, LLC. All rights reserved.
57 | //
58 | // Created by khammond on Mon Oct 29 2001.
59 | // Formatted by Timothy Hatcher on Sun Jul 4 2004.
60 | // Copyright (c) 2001 Kyle Hammond. All rights reserved.
61 | // Original development by Dave Winer.
62 | //
63 | // FOUND HERE http://idevkit.com/forums/tutorials-code-samples-sdk/8-nsdata-base64-extension.html
64 | // ================================================================================================
65 |
66 | static char encodingTable[64] = {
67 | 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
68 | 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
69 | 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
70 | 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' };
71 |
72 |
73 | + (NSData *) newDataWithBase64EncodedString:(NSString *) string {
74 | return [[NSData alloc] initWithBase64EncodedString:string];
75 | }
76 |
77 | - (id) initWithBase64EncodedString:(NSString *) string {
78 | NSMutableData *mutableData = nil;
79 |
80 | if( string ) {
81 | unsigned long ixtext = 0;
82 | unsigned long lentext = 0;
83 | unsigned char ch = 0;
84 | unsigned char inbuf[4] = {0,0,0,0}, outbuf[3] = {0,0,0};
85 | short i = 0, ixinbuf = 0;
86 | BOOL flignore = NO;
87 | BOOL flendtext = NO;
88 | NSData *base64Data = nil;
89 | const unsigned char *base64Bytes = nil;
90 |
91 | // Convert the string to ASCII data.
92 | base64Data = [string dataUsingEncoding:NSASCIIStringEncoding];
93 | base64Bytes = [base64Data bytes];
94 | mutableData = [NSMutableData dataWithCapacity:[base64Data length]];
95 | lentext = [base64Data length];
96 |
97 | while( YES ) {
98 | if( ixtext >= lentext ) break;
99 | ch = base64Bytes[ixtext++];
100 | flignore = NO;
101 |
102 | if( ( ch >= 'A' ) && ( ch <= 'Z' ) ) ch = ch - 'A';
103 | else if( ( ch >= 'a' ) && ( ch <= 'z' ) ) ch = ch - 'a' + 26;
104 | else if( ( ch >= '0' ) && ( ch <= '9' ) ) ch = ch - '0' + 52;
105 | else if( ch == '+' ) ch = 62;
106 | else if( ch == '=' ) flendtext = YES;
107 | else if( ch == '/' ) ch = 63;
108 | else flignore = YES;
109 |
110 | if( ! flignore ) {
111 | short ctcharsinbuf = 3;
112 | BOOL flbreak = NO;
113 |
114 | if( flendtext ) {
115 | if( ! ixinbuf ) break;
116 | if( ( ixinbuf == 1 ) || ( ixinbuf == 2 ) ) ctcharsinbuf = 1;
117 | else ctcharsinbuf = 2;
118 | ixinbuf = 3;
119 | flbreak = YES;
120 | }
121 |
122 | inbuf [ixinbuf++] = ch;
123 |
124 | if( ixinbuf == 4 ) {
125 | ixinbuf = 0;
126 | outbuf [0] = ( inbuf[0] << 2 ) | ( ( inbuf[1] & 0x30) >> 4 );
127 | outbuf [1] = ( ( inbuf[1] & 0x0F ) << 4 ) | ( ( inbuf[2] & 0x3C ) >> 2 );
128 | outbuf [2] = ( ( inbuf[2] & 0x03 ) << 6 ) | ( inbuf[3] & 0x3F );
129 |
130 | for( i = 0; i < ctcharsinbuf; i++ )
131 | [mutableData appendBytes:&outbuf[i] length:1];
132 | }
133 |
134 | if( flbreak ) break;
135 | }
136 | }
137 | }
138 |
139 | self = [self initWithData:mutableData];
140 | return self;
141 | }
142 |
143 | #pragma mark -
144 |
145 | - (NSString *) base64Encoding {
146 | return [self base64EncodingWithLineLength:0];
147 | }
148 |
149 | - (NSString *) base64EncodingWithLineLength:(unsigned int) lineLength {
150 | const unsigned char *bytes = [self bytes];
151 | NSMutableString *result = [NSMutableString stringWithCapacity:[self length]];
152 | unsigned long ixtext = 0;
153 | unsigned long lentext = [self length];
154 | long ctremaining = 0;
155 | unsigned char inbuf[3], outbuf[4];
156 | short i = 0;
157 | short charsonline = 0, ctcopy = 0;
158 | unsigned long ix = 0;
159 |
160 | while( YES ) {
161 | ctremaining = lentext - ixtext;
162 | if( ctremaining <= 0 ) break;
163 |
164 | for( i = 0; i < 3; i++ ) {
165 | ix = ixtext + i;
166 | if( ix < lentext ) inbuf[i] = bytes[ix];
167 | else inbuf [i] = 0;
168 | }
169 |
170 | outbuf [0] = (inbuf [0] & 0xFC) >> 2;
171 | outbuf [1] = ((inbuf [0] & 0x03) << 4) | ((inbuf [1] & 0xF0) >> 4);
172 | outbuf [2] = ((inbuf [1] & 0x0F) << 2) | ((inbuf [2] & 0xC0) >> 6);
173 | outbuf [3] = inbuf [2] & 0x3F;
174 | ctcopy = 4;
175 |
176 | switch( ctremaining ) {
177 | case 1:
178 | ctcopy = 2;
179 | break;
180 | case 2:
181 | ctcopy = 3;
182 | break;
183 | }
184 |
185 | for( i = 0; i < ctcopy; i++ )
186 | [result appendFormat:@"%c", encodingTable[outbuf[i]]];
187 |
188 | for( i = ctcopy; i < 4; i++ )
189 | [result appendFormat:@"%c",'='];
190 |
191 | ixtext += 3;
192 | charsonline += 4;
193 |
194 | if( lineLength > 0 ) {
195 | if (charsonline >= lineLength) {
196 | charsonline = 0;
197 | [result appendString:@"\n"];
198 | }
199 | }
200 | }
201 |
202 | return result;
203 | }
204 |
205 |
206 |
207 | // ================================================================================================
208 | // NSData+gzip.m
209 | // Drip
210 | //
211 | // Created by Nur Monson on 8/21/07.
212 | // Copyright 2007 theidiotproject. All rights reserved.
213 | //
214 | // FOUND HERE http://code.google.com/p/drop-osx/source/browse/trunk/Source/NSData%2Bgzip.m
215 | //
216 | // Also Check http://deusty.blogspot.com/2007/07/gzip-compressiondecompression.html
217 | // ================================================================================================
218 |
219 | #pragma mark -
220 | #pragma mark GZIP
221 |
222 | - (NSData *)gzipDeflate
223 | {
224 | if ([self length] == 0) return self;
225 |
226 | z_stream strm;
227 |
228 | strm.zalloc = Z_NULL;
229 | strm.zfree = Z_NULL;
230 | strm.opaque = Z_NULL;
231 | strm.total_out = 0;
232 | strm.next_in=(Bytef *)[self bytes];
233 | strm.avail_in = [self length];
234 |
235 | // Compresssion Levels:
236 | // Z_NO_COMPRESSION
237 | // Z_BEST_SPEED
238 | // Z_BEST_COMPRESSION
239 | // Z_DEFAULT_COMPRESSION
240 |
241 | if (deflateInit2(&strm, Z_DEFAULT_COMPRESSION, Z_DEFLATED, (15+16), 8, Z_DEFAULT_STRATEGY) != Z_OK) return nil;
242 |
243 | NSMutableData *compressed = [NSMutableData dataWithLength:16384]; // 16K chunks for expansion
244 |
245 | do {
246 |
247 | if (strm.total_out >= [compressed length])
248 | [compressed increaseLengthBy: 16384];
249 |
250 | strm.next_out = [compressed mutableBytes] + strm.total_out;
251 | strm.avail_out = [compressed length] - strm.total_out;
252 |
253 | deflate(&strm, Z_FINISH);
254 |
255 | } while (strm.avail_out == 0);
256 |
257 | deflateEnd(&strm);
258 |
259 | [compressed setLength: strm.total_out];
260 | return [NSData dataWithData:compressed];
261 | }
262 |
263 | - (NSData *)gzipInflate
264 | {
265 | if ([self length] == 0) return self;
266 |
267 | unsigned full_length = [self length];
268 | unsigned half_length = [self length] / 2;
269 |
270 | NSMutableData *decompressed = [NSMutableData dataWithLength: full_length + half_length];
271 | BOOL done = NO;
272 | int status;
273 |
274 | z_stream strm;
275 | strm.next_in = (Bytef *)[self bytes];
276 | strm.avail_in = [self length];
277 | strm.total_out = 0;
278 | strm.zalloc = Z_NULL;
279 | strm.zfree = Z_NULL;
280 |
281 | if (inflateInit2(&strm, (15+32)) != Z_OK) return nil;
282 | while (!done)
283 | {
284 | // Make sure we have enough room and reset the lengths.
285 | if (strm.total_out >= [decompressed length])
286 | [decompressed increaseLengthBy: half_length];
287 | strm.next_out = [decompressed mutableBytes] + strm.total_out;
288 | strm.avail_out = [decompressed length] - strm.total_out;
289 |
290 | // Inflate another chunk.
291 | status = inflate (&strm, Z_SYNC_FLUSH);
292 | if (status == Z_STREAM_END) done = YES;
293 | else if (status != Z_OK) break;
294 | }
295 | if (inflateEnd (&strm) != Z_OK) return nil;
296 |
297 | // Set real length.
298 | if (done)
299 | {
300 | [decompressed setLength: strm.total_out];
301 | return [NSData dataWithData: decompressed];
302 | }
303 | else return nil;
304 | }
305 |
306 | @end
307 |
308 |
--------------------------------------------------------------------------------
/TBXML-Code/TBXML+HTTP.m:
--------------------------------------------------------------------------------
1 | //
2 | // TBXML+HTTP.m
3 | //
4 | // Created by Tom Bradley on 29/01/2011.
5 | // Copyright 2012 71Squared All rights reserved.
6 | //
7 |
8 | #import "TBXML+HTTP.h"
9 |
10 | @implementation NSMutableURLRequest (TBXML_HTTP)
11 |
12 |
13 | + (NSMutableURLRequest*) tbxmlGetRequestWithURL:(NSURL*)url {
14 |
15 | NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
16 | [request setURL:url];
17 | [request setHTTPMethod:@"GET"];
18 |
19 |
20 | #ifndef ARC_ENABLED
21 | return [request autorelease];
22 | #else
23 | return request;
24 | #endif
25 |
26 | }
27 |
28 | + (NSMutableURLRequest*) tbxmlPostRequestWithURL:(NSURL*)url parameters:(NSDictionary*)parameters {
29 |
30 | NSMutableArray * params = [NSMutableArray new];
31 |
32 | for (NSString * key in [parameters allKeys]) {
33 | [params addObject:[NSString stringWithFormat:@"%@=%@", key, [parameters objectForKey:key]]];
34 | }
35 |
36 | NSData * postData = [[params componentsJoinedByString:@"&"] dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
37 | NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
38 |
39 | NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
40 | [request setURL:url];
41 | [request setHTTPMethod:@"POST"];
42 | [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
43 | [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
44 | [request setHTTPBody:postData];
45 |
46 | #ifndef ARC_ENABLED
47 | [params release];
48 | return [request autorelease];
49 | #else
50 | return request;
51 | #endif
52 | }
53 |
54 | @end
55 |
56 |
57 | @implementation NSURLConnection (TBXML_HTTP)
58 |
59 | + (void)tbxmlAsyncRequest:(NSURLRequest *)request success:(TBXMLAsyncRequestSuccessBlock)successBlock failure:(TBXMLAsyncRequestFailureBlock)failureBlock {
60 |
61 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
62 |
63 | @autoreleasepool {
64 | NSURLResponse *response = nil;
65 | NSError *error = nil;
66 | NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
67 |
68 | if (error) {
69 | failureBlock(data,error);
70 | } else {
71 | successBlock(data,response);
72 | }
73 | }
74 | });
75 | }
76 |
77 | @end
78 |
79 |
80 | @implementation TBXML (TBXML_HTTP)
81 |
82 | + (id)newTBXMLWithURL:(NSURL*)aURL success:(TBXMLSuccessBlock)successBlock failure:(TBXMLFailureBlock)failureBlock {
83 | return [[TBXML alloc] initWithURL:aURL success:successBlock failure:failureBlock];
84 | }
85 |
86 | - (id)initWithURL:(NSURL*)aURL success:(TBXMLSuccessBlock)successBlock failure:(TBXMLFailureBlock)failureBlock {
87 | self = [self init];
88 | if (self != nil) {
89 |
90 | TBXMLAsyncRequestSuccessBlock requestSuccessBlock = ^(NSData *data, NSURLResponse *response) {
91 |
92 | NSError *error = nil;
93 | [self decodeData:data withError:&error];
94 |
95 | // If TBXML found a root node, process element and iterate all children
96 | if (!error) {
97 | successBlock(self);
98 | } else {
99 | failureBlock(self, error);
100 | }
101 | };
102 |
103 | TBXMLAsyncRequestFailureBlock requestFailureBlock = ^(NSData *data, NSError *error) {
104 | failureBlock(self, error);
105 | };
106 |
107 |
108 | [NSURLConnection tbxmlAsyncRequest:[NSMutableURLRequest tbxmlGetRequestWithURL:aURL]
109 | success:requestSuccessBlock
110 | failure:requestFailureBlock];
111 | }
112 | return self;
113 | }
114 |
115 | @end
--------------------------------------------------------------------------------
/TBXML-Code/TBXML.m:
--------------------------------------------------------------------------------
1 | // ================================================================================================
2 | // TBXML.m
3 | // Fast processing of XML files
4 | //
5 | // ================================================================================================
6 | // Created by Tom Bradley on 21/10/2009.
7 | // Version 1.5
8 | //
9 | // Copyright 2012 71Squared All rights reserved.
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy
12 | // of this software and associated documentation files (the "Software"), to deal
13 | // in the Software without restriction, including without limitation the rights
14 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | // copies of the Software, and to permit persons to whom the Software is
16 | // furnished to do so, subject to the following conditions:
17 | //
18 | // The above copyright notice and this permission notice shall be included in
19 | // all copies or substantial portions of the Software.
20 | //
21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 | // THE SOFTWARE.
28 | // ================================================================================================
29 | #import "TBXML.h"
30 |
31 | // ================================================================================================
32 | // Private methods
33 | // ================================================================================================
34 | @interface TBXML (Private)
35 | + (NSString *) errorTextForCode:(int)code;
36 | + (NSError *) errorWithCode:(int)code;
37 | + (NSError *) errorWithCode:(int)code userInfo:(NSDictionary *)userInfo;
38 | - (void) decodeBytes;
39 | - (int) allocateBytesOfLength:(long)length error:(NSError **)error;
40 | - (TBXMLElement*) nextAvailableElement;
41 | - (TBXMLAttribute*) nextAvailableAttribute;
42 | @end
43 |
44 | // ================================================================================================
45 | // Public Implementation
46 | // ================================================================================================
47 | @implementation TBXML
48 |
49 | @synthesize rootXMLElement;
50 |
51 | + (id)newTBXMLWithXMLString:(NSString*)aXMLString {
52 | return [[TBXML alloc] initWithXMLString:aXMLString];
53 | }
54 |
55 | + (id)newTBXMLWithXMLString:(NSString*)aXMLString error:(NSError *__autoreleasing *)error {
56 | return [[TBXML alloc] initWithXMLString:aXMLString error:error];
57 | }
58 |
59 | + (id)newTBXMLWithXMLData:(NSData*)aData {
60 | return [[TBXML alloc] initWithXMLData:aData];
61 | }
62 |
63 | + (id)newTBXMLWithXMLData:(NSData*)aData error:(NSError *__autoreleasing *)error {
64 | return [[TBXML alloc] initWithXMLData:aData error:error];
65 | }
66 |
67 | + (id)newTBXMLWithXMLFile:(NSString*)aXMLFile {
68 | return [[TBXML alloc] initWithXMLFile:aXMLFile];
69 | }
70 |
71 | + (id)newTBXMLWithXMLFile:(NSString*)aXMLFile error:(NSError *__autoreleasing *)error {
72 | return [[TBXML alloc] initWithXMLFile:aXMLFile error:error];
73 | }
74 |
75 | + (id)newTBXMLWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension {
76 | return [[TBXML alloc] initWithXMLFile:aXMLFile fileExtension:aFileExtension];
77 | }
78 |
79 | + (id)newTBXMLWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension error:(NSError *__autoreleasing *)error {
80 | return [[TBXML alloc] initWithXMLFile:aXMLFile fileExtension:aFileExtension error:error];
81 | }
82 |
83 | - (id)init {
84 | self = [super init];
85 | if (self != nil) {
86 | rootXMLElement = nil;
87 |
88 | currentElementBuffer = 0;
89 | currentAttributeBuffer = 0;
90 |
91 | currentElement = 0;
92 | currentAttribute = 0;
93 |
94 | bytes = 0;
95 | bytesLength = 0;
96 | }
97 | return self;
98 | }
99 | - (id)initWithXMLString:(NSString*)aXMLString {
100 | NSError *error = nil;
101 | return [self initWithXMLString:aXMLString error:&error];
102 | }
103 |
104 | - (id)initWithXMLString:(NSString*)aXMLString error:(NSError *__autoreleasing *)error {
105 | self = [self init];
106 | if (self != nil) {
107 |
108 |
109 | // allocate memory for byte array
110 | int result = [self allocateBytesOfLength:[aXMLString lengthOfBytesUsingEncoding:NSUTF8StringEncoding] error:error];
111 |
112 | // if an error occured, return
113 | if (result != D_TBXML_SUCCESS)
114 | return self;
115 |
116 | // copy string to byte array
117 | [aXMLString getBytes:bytes maxLength:bytesLength usedLength:0 encoding:NSUTF8StringEncoding options:NSStringEncodingConversionAllowLossy range:NSMakeRange(0, bytesLength) remainingRange:nil];
118 |
119 | // set null terminator at end of byte array
120 | bytes[bytesLength] = 0;
121 |
122 | // decode xml data
123 | [self decodeBytes];
124 |
125 | // Check for root element
126 | if (error && !*error && !self.rootXMLElement) {
127 | *error = [TBXML errorWithCode:D_TBXML_DECODE_FAILURE];
128 | }
129 | }
130 | return self;
131 | }
132 |
133 | - (id)initWithXMLData:(NSData*)aData {
134 | NSError *error = nil;
135 | return [self initWithXMLData:aData error:&error];
136 | }
137 |
138 | - (id)initWithXMLData:(NSData*)aData error:(NSError **)error {
139 | self = [self init];
140 | if (self != nil) {
141 | // decode aData
142 | [self decodeData:aData withError:error];
143 | }
144 |
145 | return self;
146 | }
147 |
148 | - (id)initWithXMLFile:(NSString*)aXMLFile {
149 | NSError *error = nil;
150 | return [self initWithXMLFile:aXMLFile error:&error];
151 | }
152 |
153 | - (id)initWithXMLFile:(NSString*)aXMLFile error:(NSError **)error {
154 | NSString * filename = [aXMLFile stringByDeletingPathExtension];
155 | NSString * extension = [aXMLFile pathExtension];
156 |
157 | self = [self initWithXMLFile:filename fileExtension:extension error:error];
158 | if (self != nil) {
159 |
160 | }
161 | return self;
162 | }
163 |
164 | - (id)initWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension {
165 | NSError *error = nil;
166 | return [self initWithXMLFile:aXMLFile fileExtension:aFileExtension error:&error];
167 | }
168 |
169 | - (id)initWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension error:(NSError **)error {
170 | self = [self init];
171 | if (self != nil) {
172 |
173 | NSData * data;
174 |
175 | // Get the bundle that this class resides in. This allows to load resources from the app bundle when running unit tests.
176 | NSString * bundlePath = [[NSBundle bundleForClass:[self class]] pathForResource:aXMLFile ofType:aFileExtension];
177 |
178 | if (!bundlePath) {
179 | if (error) {
180 | NSDictionary * userInfo = [NSDictionary dictionaryWithObjectsAndKeys:[aXMLFile stringByAppendingPathExtension:aFileExtension], NSFilePathErrorKey, nil];
181 | *error = [TBXML errorWithCode:D_TBXML_FILE_NOT_FOUND_IN_BUNDLE userInfo:userInfo];
182 | }
183 | } else {
184 | SEL dataWithUncompressedContentsOfFile = NSSelectorFromString(@"dataWithUncompressedContentsOfFile:");
185 |
186 | // Get uncompressed file contents if TBXML+Compression has been included
187 | if ([[NSData class] respondsToSelector:dataWithUncompressedContentsOfFile]) {
188 |
189 | #pragma clang diagnostic push
190 | #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
191 | data = [[NSData class] performSelector:dataWithUncompressedContentsOfFile withObject:bundlePath];
192 | #pragma clang diagnostic pop
193 |
194 | } else {
195 | data = [NSData dataWithContentsOfFile:bundlePath];
196 | }
197 |
198 | // decode data
199 | [self decodeData:data withError:error];
200 |
201 | // Check for root element
202 | if (error && !*error && !self.rootXMLElement) {
203 | *error = [TBXML errorWithCode:D_TBXML_DECODE_FAILURE];
204 | }
205 | }
206 | }
207 | return self;
208 | }
209 |
210 | - (int) decodeData:(NSData*)data {
211 | NSError *error = nil;
212 | return [self decodeData:data withError:&error];
213 | }
214 |
215 | - (int) decodeData:(NSData*)data withError:(NSError **)error {
216 |
217 | NSError *localError = nil;
218 |
219 | // allocate memory for byte array
220 | int result = [self allocateBytesOfLength:[data length] error:&localError];
221 |
222 | // ensure no errors during allocation
223 | if (result == D_TBXML_SUCCESS) {
224 |
225 | // copy data to byte array
226 | [data getBytes:bytes length:bytesLength];
227 |
228 | // set null terminator at end of byte array
229 | bytes[bytesLength] = 0;
230 |
231 | // decode xml data
232 | [self decodeBytes];
233 |
234 | if (!self.rootXMLElement) {
235 | localError = [TBXML errorWithCode:D_TBXML_DECODE_FAILURE];
236 | }
237 | }
238 |
239 | // assign local error to pointer
240 | if (error) *error = localError;
241 |
242 | // return success or error code
243 | return localError == nil ? D_TBXML_SUCCESS : [localError code];
244 | }
245 |
246 | @end
247 |
248 |
249 | // ================================================================================================
250 | // Static Functions Implementation
251 | // ================================================================================================
252 |
253 | #pragma mark -
254 | #pragma mark Static Functions implementation
255 |
256 | @implementation TBXML (StaticFunctions)
257 |
258 | + (NSString*) elementName:(TBXMLElement*)aXMLElement {
259 | if (nil == aXMLElement->name) return @"";
260 | return [NSString stringWithCString:&aXMLElement->name[0] encoding:NSUTF8StringEncoding];
261 | }
262 |
263 | + (NSString*) elementName:(TBXMLElement*)aXMLElement error:(NSError **)error {
264 | // check for nil element
265 | if (nil == aXMLElement) {
266 | if (error) *error = [TBXML errorWithCode:D_TBXML_ELEMENT_IS_NIL];
267 | return @"";
268 | }
269 |
270 | // check for nil element name
271 | if (nil == aXMLElement->name || strlen(aXMLElement->name) == 0) {
272 | if (error) *error = [TBXML errorWithCode:D_TBXML_ELEMENT_NAME_IS_NIL];
273 | return @"";
274 | }
275 |
276 | return [NSString stringWithCString:&aXMLElement->name[0] encoding:NSUTF8StringEncoding];
277 | }
278 |
279 | + (NSString*) attributeName:(TBXMLAttribute*)aXMLAttribute {
280 | if (nil == aXMLAttribute->name) return @"";
281 | return [NSString stringWithCString:&aXMLAttribute->name[0] encoding:NSUTF8StringEncoding];
282 | }
283 |
284 | + (NSString*) attributeName:(TBXMLAttribute*)aXMLAttribute error:(NSError **)error {
285 | // check for nil attribute
286 | if (nil == aXMLAttribute) {
287 | if (error) *error = [TBXML errorWithCode:D_TBXML_ATTRIBUTE_IS_NIL];
288 | return @"";
289 | }
290 |
291 | // check for nil attribute name
292 | if (nil == aXMLAttribute->name) {
293 | if (error) *error = [TBXML errorWithCode:D_TBXML_ATTRIBUTE_NAME_IS_NIL];
294 | return @"";
295 | }
296 |
297 | return [NSString stringWithCString:&aXMLAttribute->name[0] encoding:NSUTF8StringEncoding];
298 | }
299 |
300 |
301 | + (NSString*) attributeValue:(TBXMLAttribute*)aXMLAttribute {
302 | if (nil == aXMLAttribute->value) return @"";
303 | return [NSString stringWithCString:&aXMLAttribute->value[0] encoding:NSUTF8StringEncoding];
304 | }
305 |
306 | + (NSString*) attributeValue:(TBXMLAttribute*)aXMLAttribute error:(NSError **)error {
307 | // check for nil attribute
308 | if (nil == aXMLAttribute) {
309 | if (error) *error = [TBXML errorWithCode:D_TBXML_ATTRIBUTE_IS_NIL];
310 | return @"";
311 | }
312 |
313 | return [NSString stringWithCString:&aXMLAttribute->value[0] encoding:NSUTF8StringEncoding];
314 | }
315 |
316 | + (NSString*) textForElement:(TBXMLElement*)aXMLElement {
317 | if (nil == aXMLElement->text) return @"";
318 | return [NSString stringWithCString:&aXMLElement->text[0] encoding:NSUTF8StringEncoding];
319 | }
320 |
321 | + (NSString*) textForElement:(TBXMLElement*)aXMLElement error:(NSError **)error {
322 | // check for nil element
323 | if (nil == aXMLElement) {
324 | if (error) *error = [TBXML errorWithCode:D_TBXML_ELEMENT_IS_NIL];
325 | return @"";
326 | }
327 |
328 | // check for nil text value
329 | if (nil == aXMLElement->text || strlen(aXMLElement->text) == 0) {
330 | if (error) *error = [TBXML errorWithCode:D_TBXML_ELEMENT_TEXT_IS_NIL];
331 | return @"";
332 | }
333 |
334 | return [NSString stringWithCString:&aXMLElement->text[0] encoding:NSUTF8StringEncoding];
335 | }
336 |
337 | + (NSString*) valueOfAttributeNamed:(NSString *)aName forElement:(TBXMLElement*)aXMLElement {
338 | const char * name = [aName cStringUsingEncoding:NSUTF8StringEncoding];
339 | NSString * value = nil;
340 | TBXMLAttribute * attribute = aXMLElement->firstAttribute;
341 | while (attribute) {
342 | if (strlen(attribute->name) == strlen(name) && memcmp(attribute->name,name,strlen(name)) == 0) {
343 | value = [NSString stringWithCString:&attribute->value[0] encoding:NSUTF8StringEncoding];
344 | break;
345 | }
346 | attribute = attribute->next;
347 | }
348 | return value;
349 | }
350 |
351 | + (NSString*) valueOfAttributeNamed:(NSString *)aName forElement:(TBXMLElement*)aXMLElement error:(NSError **)error {
352 | // check for nil element
353 | if (nil == aXMLElement) {
354 | if (error) *error = [TBXML errorWithCode:D_TBXML_ELEMENT_IS_NIL];
355 | return @"";
356 | }
357 |
358 | // check for nil name parameter
359 | if (nil == aName) {
360 | if (error) *error = [TBXML errorWithCode:D_TBXML_ATTRIBUTE_NAME_IS_NIL];
361 | return @"";
362 | }
363 |
364 | const char * name = [aName cStringUsingEncoding:NSUTF8StringEncoding];
365 | NSString * value = nil;
366 |
367 | TBXMLAttribute * attribute = aXMLElement->firstAttribute;
368 | while (attribute) {
369 | if (strlen(attribute->name) == strlen(name) && memcmp(attribute->name,name,strlen(name)) == 0) {
370 | if (attribute->value[0])
371 | value = [NSString stringWithCString:&attribute->value[0] encoding:NSUTF8StringEncoding];
372 | else
373 | value = [NSString stringWithString:@""];
374 |
375 | break;
376 | }
377 | attribute = attribute->next;
378 | }
379 |
380 | // check for attribute not found
381 | if (!value) {
382 | if (error) *error = [TBXML errorWithCode:D_TBXML_ATTRIBUTE_NOT_FOUND];
383 | return @"";
384 | }
385 |
386 | return value;
387 | }
388 |
389 | + (TBXMLElement*) childElementNamed:(NSString*)aName parentElement:(TBXMLElement*)aParentXMLElement{
390 |
391 | TBXMLElement * xmlElement = aParentXMLElement->firstChild;
392 | const char * name = [aName cStringUsingEncoding:NSUTF8StringEncoding];
393 | while (xmlElement) {
394 | if (strlen(xmlElement->name) == strlen(name) && memcmp(xmlElement->name,name,strlen(name)) == 0) {
395 | return xmlElement;
396 | }
397 | xmlElement = xmlElement->nextSibling;
398 | }
399 | return nil;
400 | }
401 |
402 | + (TBXMLElement*) childElementNamed:(NSString*)aName parentElement:(TBXMLElement*)aParentXMLElement error:(NSError **)error {
403 | // check for nil element
404 | if (nil == aParentXMLElement) {
405 | if (error) *error = [TBXML errorWithCode:D_TBXML_ELEMENT_IS_NIL];
406 | return nil;
407 | }
408 |
409 | // check for nil name parameter
410 | if (nil == aName) {
411 | if (error) *error = [TBXML errorWithCode:D_TBXML_PARAM_NAME_IS_NIL];
412 | return nil;
413 | }
414 |
415 | TBXMLElement * xmlElement = aParentXMLElement->firstChild;
416 | const char * name = [aName cStringUsingEncoding:NSUTF8StringEncoding];
417 | while (xmlElement) {
418 | if (strlen(xmlElement->name) == strlen(name) && memcmp(xmlElement->name,name,strlen(name)) == 0) {
419 | return xmlElement;
420 | }
421 | xmlElement = xmlElement->nextSibling;
422 | }
423 |
424 | if (error) *error = [TBXML errorWithCode:D_TBXML_ELEMENT_NOT_FOUND];
425 |
426 | return nil;
427 | }
428 |
429 | + (TBXMLElement*) nextSiblingNamed:(NSString*)aName searchFromElement:(TBXMLElement*)aXMLElement{
430 | TBXMLElement * xmlElement = aXMLElement->nextSibling;
431 | const char * name = [aName cStringUsingEncoding:NSUTF8StringEncoding];
432 | while (xmlElement) {
433 | if (strlen(xmlElement->name) == strlen(name) && memcmp(xmlElement->name,name,strlen(name)) == 0) {
434 | return xmlElement;
435 | }
436 | xmlElement = xmlElement->nextSibling;
437 | }
438 | return nil;
439 | }
440 |
441 | + (TBXMLElement*) nextSiblingNamed:(NSString*)aName searchFromElement:(TBXMLElement*)aXMLElement error:(NSError **)error {
442 | // check for nil element
443 | if (nil == aXMLElement) {
444 | if (error) *error = [TBXML errorWithCode:D_TBXML_ELEMENT_IS_NIL];
445 | return nil;
446 | }
447 |
448 | // check for nil name parameter
449 | if (nil == aName) {
450 | if (error) *error = [TBXML errorWithCode:D_TBXML_PARAM_NAME_IS_NIL];
451 | return nil;
452 | }
453 |
454 | TBXMLElement * xmlElement = aXMLElement->nextSibling;
455 | const char * name = [aName cStringUsingEncoding:NSUTF8StringEncoding];
456 | while (xmlElement) {
457 | if (strlen(xmlElement->name) == strlen(name) && memcmp(xmlElement->name,name,strlen(name)) == 0) {
458 | return xmlElement;
459 | }
460 | xmlElement = xmlElement->nextSibling;
461 | }
462 |
463 | if (error) *error = [TBXML errorWithCode:D_TBXML_ELEMENT_NOT_FOUND];
464 |
465 | return nil;
466 | }
467 |
468 | + (void)iterateElementsForQuery:(NSString *)query fromElement:(TBXMLElement *)anElement withBlock:(TBXMLIterateBlock)iterateBlock {
469 |
470 | NSArray *components = [query componentsSeparatedByString:@"."];
471 | TBXMLElement *currTBXMLElement = anElement;
472 |
473 | // navigate down
474 | for (NSInteger i=0; i < components.count; ++i) {
475 | NSString *iTagName = [components objectAtIndex:i];
476 |
477 | if ([iTagName isEqualToString:@"*"]) {
478 | currTBXMLElement = currTBXMLElement->firstChild;
479 |
480 | // different behavior depending on if this is the end of the query or midstream
481 | if (i < (components.count - 1)) {
482 | // midstream
483 | do {
484 | NSString *restOfQuery = [[components subarrayWithRange:NSMakeRange(i + 1, components.count - i - 1)] componentsJoinedByString:@"."];
485 | [TBXML iterateElementsForQuery:restOfQuery fromElement:currTBXMLElement withBlock:iterateBlock];
486 | } while ((currTBXMLElement = currTBXMLElement->nextSibling));
487 |
488 | }
489 | } else {
490 | currTBXMLElement = [TBXML childElementNamed:iTagName parentElement:currTBXMLElement];
491 | }
492 |
493 | if (!currTBXMLElement) {
494 | break;
495 | }
496 | }
497 |
498 | if (currTBXMLElement) {
499 | // enumerate
500 | NSString *childTagName = [components lastObject];
501 |
502 | if ([childTagName isEqualToString:@"*"]) {
503 | childTagName = nil;
504 | }
505 |
506 | do {
507 | iterateBlock(currTBXMLElement);
508 | } while (childTagName ? (currTBXMLElement = [TBXML nextSiblingNamed:childTagName searchFromElement:currTBXMLElement]) : (currTBXMLElement = currTBXMLElement->nextSibling));
509 | }
510 | }
511 |
512 | + (void)iterateAttributesOfElement:(TBXMLElement *)anElement withBlock:(TBXMLIterateAttributeBlock)iterateAttributeBlock {
513 |
514 | // Obtain first attribute from element
515 | TBXMLAttribute * attribute = anElement->firstAttribute;
516 |
517 | // if attribute is valid
518 |
519 | while (attribute) {
520 | // Call the iterateAttributeBlock with the attribute, it's name and value
521 | iterateAttributeBlock(attribute, [TBXML attributeName:attribute], [TBXML attributeValue:attribute]);
522 |
523 | // Obtain the next attribute
524 | attribute = attribute->next;
525 | }
526 | }
527 |
528 | @end
529 |
530 |
531 | // ================================================================================================
532 | // Private Implementation
533 | // ================================================================================================
534 |
535 | #pragma mark -
536 | #pragma mark Private implementation
537 |
538 | @implementation TBXML (Private)
539 |
540 | + (NSString *) errorTextForCode:(int)code {
541 | NSString * codeText = @"";
542 |
543 | switch (code) {
544 | case D_TBXML_DATA_NIL: codeText = @"Data is nil"; break;
545 | case D_TBXML_DECODE_FAILURE: codeText = @"Decode failure"; break;
546 | case D_TBXML_MEMORY_ALLOC_FAILURE: codeText = @"Unable to allocate memory"; break;
547 | case D_TBXML_FILE_NOT_FOUND_IN_BUNDLE: codeText = @"File not found in bundle"; break;
548 |
549 | case D_TBXML_ELEMENT_IS_NIL: codeText = @"Element is nil"; break;
550 | case D_TBXML_ELEMENT_NAME_IS_NIL: codeText = @"Element name is nil"; break;
551 | case D_TBXML_ATTRIBUTE_IS_NIL: codeText = @"Attribute is nil"; break;
552 | case D_TBXML_ATTRIBUTE_NAME_IS_NIL: codeText = @"Attribute name is nil"; break;
553 | case D_TBXML_ELEMENT_TEXT_IS_NIL: codeText = @"Element text is nil"; break;
554 | case D_TBXML_PARAM_NAME_IS_NIL: codeText = @"Parameter name is nil"; break;
555 | case D_TBXML_ATTRIBUTE_NOT_FOUND: codeText = @"Attribute not found"; break;
556 | case D_TBXML_ELEMENT_NOT_FOUND: codeText = @"Element not found"; break;
557 |
558 | default: codeText = @"No Error Description!"; break;
559 | }
560 |
561 | return codeText;
562 | }
563 |
564 | + (NSError *) errorWithCode:(int)code {
565 |
566 | NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:[TBXML errorTextForCode:code], NSLocalizedDescriptionKey, nil];
567 |
568 | return [NSError errorWithDomain:D_TBXML_DOMAIN
569 | code:code
570 | userInfo:userInfo];
571 | }
572 |
573 | + (NSError *) errorWithCode:(int)code userInfo:(NSMutableDictionary *)someUserInfo {
574 |
575 | NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:someUserInfo];
576 | [userInfo setValue:[TBXML errorTextForCode:code] forKey:NSLocalizedDescriptionKey];
577 |
578 | return [NSError errorWithDomain:D_TBXML_DOMAIN
579 | code:code
580 | userInfo:userInfo];
581 | }
582 |
583 | - (int) allocateBytesOfLength:(long)length error:(NSError **)error {
584 | bytesLength = length;
585 |
586 | NSError *localError = nil;
587 |
588 | if(!length) {
589 | localError = [TBXML errorWithCode:D_TBXML_DATA_NIL];
590 | }
591 |
592 | bytes = malloc(bytesLength+1);
593 |
594 | if(!bytes) {
595 | localError = [TBXML errorWithCode:D_TBXML_MEMORY_ALLOC_FAILURE];
596 | }
597 |
598 | if (error) *error = localError;
599 |
600 | return localError == nil ? D_TBXML_SUCCESS : [localError code];
601 | }
602 |
603 | - (void) decodeBytes {
604 |
605 | // -----------------------------------------------------------------------------
606 | // Process xml
607 | // -----------------------------------------------------------------------------
608 |
609 | // set elementStart pointer to the start of our xml
610 | char * elementStart=bytes;
611 |
612 | // set parent element to nil
613 | TBXMLElement * parentXMLElement = nil;
614 |
615 | // find next element start
616 | while ((elementStart = strstr(elementStart,"<"))) {
617 |
618 | // detect comment section
619 | if (strncmp(elementStart,"") + 3;
621 | continue;
622 | }
623 |
624 | // detect cdata section within element text
625 | int isCDATA = strncmp(elementStart,"");
632 |
633 | // find start of next element skipping any cdata sections within text
634 | char * elementEnd = CDATAEnd;
635 |
636 | // find next open tag
637 | elementEnd = strstr(elementEnd,"<");
638 | // if open tag is a cdata section
639 | while (strncmp(elementEnd,"");
642 | // find next open tag
643 | elementEnd = strstr(elementEnd,"<");
644 | }
645 |
646 | // calculate length of cdata content
647 | long CDATALength = CDATAEnd-elementStart;
648 |
649 | // calculate total length of text
650 | long textLength = elementEnd-elementStart;
651 |
652 | // remove begining cdata section tag
653 | memcpy(elementStart, elementStart+9, CDATAEnd-elementStart-9);
654 |
655 | // remove ending cdata section tag
656 | memcpy(CDATAEnd-9, CDATAEnd+3, textLength-CDATALength-3);
657 |
658 | // blank out end of text
659 | memset(elementStart+textLength-12,' ',12);
660 |
661 | // set new search start position
662 | elementStart = CDATAEnd-9;
663 | continue;
664 | }
665 |
666 |
667 | // find element end, skipping any cdata sections within attributes
668 | char * elementEnd = elementStart+1;
669 | while ((elementEnd = strpbrk(elementEnd, "<>"))) {
670 | if (strncmp(elementEnd,"")+3;
672 | } else {
673 | break;
674 | }
675 | }
676 |
677 | if (!elementEnd) break;
678 |
679 | // null terminate element end
680 | if (elementEnd) *elementEnd = 0;
681 |
682 | // null terminate element start so previous element text doesnt overrun
683 | *elementStart = 0;
684 |
685 | // get element name start
686 | char * elementNameStart = elementStart+1;
687 |
688 | // ignore tags that start with ? or ! unless cdata "text) {
700 | // trim whitespace from start of text
701 | while (isspace(*parentXMLElement->text))
702 | parentXMLElement->text++;
703 |
704 | // trim whitespace from end of text
705 | char * end = parentXMLElement->text + strlen(parentXMLElement->text)-1;
706 | while (end > parentXMLElement->text && isspace(*end))
707 | *end--=0;
708 | }
709 |
710 | parentXMLElement = parentXMLElement->parentElement;
711 |
712 | // if parent element has children clear text
713 | if (parentXMLElement && parentXMLElement->firstChild)
714 | parentXMLElement->text = 0;
715 |
716 | }
717 | continue;
718 | }
719 |
720 |
721 | // is this element opening and closing
722 | BOOL selfClosingElement = NO;
723 | if (*(elementEnd-1) == '/') {
724 | selfClosingElement = YES;
725 | }
726 |
727 |
728 | // create new xmlElement struct
729 | TBXMLElement * xmlElement = [self nextAvailableElement];
730 |
731 | // set element name
732 | xmlElement->name = elementNameStart;
733 |
734 | // if there is a parent element
735 | if (parentXMLElement) {
736 |
737 | // if this is first child of parent element
738 | if (parentXMLElement->currentChild) {
739 | // set next child element in list
740 | parentXMLElement->currentChild->nextSibling = xmlElement;
741 | xmlElement->previousSibling = parentXMLElement->currentChild;
742 |
743 | parentXMLElement->currentChild = xmlElement;
744 |
745 |
746 | } else {
747 | // set first child element
748 | parentXMLElement->currentChild = xmlElement;
749 | parentXMLElement->firstChild = xmlElement;
750 | }
751 |
752 | xmlElement->parentElement = parentXMLElement;
753 | }
754 |
755 |
756 | // in the following xml the ">" is replaced with \0 by elementEnd.
757 | // element may contain no atributes and would return nil while looking for element name end
758 | //
759 | // find end of element name
760 | char * elementNameEnd = strpbrk(xmlElement->name," /\n");
761 |
762 |
763 | // if end was found check for attributes
764 | if (elementNameEnd) {
765 |
766 | // null terminate end of elemenet name
767 | *elementNameEnd = 0;
768 |
769 | char * chr = elementNameEnd;
770 | char * name = nil;
771 | char * value = nil;
772 | char * CDATAStart = nil;
773 | char * CDATAEnd = nil;
774 | TBXMLAttribute * lastXMLAttribute = nil;
775 | TBXMLAttribute * xmlAttribute = nil;
776 | BOOL singleQuote = NO;
777 |
778 | int mode = TBXML_ATTRIBUTE_NAME_START;
779 |
780 | // loop through all characters within element
781 | while (chr++ < elementEnd) {
782 |
783 | switch (mode) {
784 | // look for start of attribute name
785 | case TBXML_ATTRIBUTE_NAME_START:
786 | if (isspace(*chr)) continue;
787 | name = chr;
788 | mode = TBXML_ATTRIBUTE_NAME_END;
789 | break;
790 | // look for end of attribute name
791 | case TBXML_ATTRIBUTE_NAME_END:
792 | if (isspace(*chr) || *chr == '=') {
793 | *chr = 0;
794 | mode = TBXML_ATTRIBUTE_VALUE_START;
795 | }
796 | break;
797 | // look for start of attribute value
798 | case TBXML_ATTRIBUTE_VALUE_START:
799 | if (isspace(*chr)) continue;
800 | if (*chr == '"' || *chr == '\'') {
801 | value = chr+1;
802 | mode = TBXML_ATTRIBUTE_VALUE_END;
803 | if (*chr == '\'')
804 | singleQuote = YES;
805 | else
806 | singleQuote = NO;
807 | }
808 | break;
809 | // look for end of attribute value
810 | case TBXML_ATTRIBUTE_VALUE_END:
811 | if (*chr == '<' && strncmp(chr, "");
824 |
825 | // remove end cdata tag
826 | memcpy(CDATAEnd, CDATAEnd+3, strlen(CDATAEnd)-2);
827 | }
828 |
829 |
830 | // create new attribute
831 | xmlAttribute = [self nextAvailableAttribute];
832 |
833 | // if this is the first attribute found, set pointer to this attribute on element
834 | if (!xmlElement->firstAttribute) xmlElement->firstAttribute = xmlAttribute;
835 | // if previous attribute found, link this attribute to previous one
836 | if (lastXMLAttribute) lastXMLAttribute->next = xmlAttribute;
837 | // set last attribute to this attribute
838 | lastXMLAttribute = xmlAttribute;
839 |
840 | // set attribute name & value
841 | xmlAttribute->name = name;
842 | xmlAttribute->value = value;
843 |
844 | // clear name and value pointers
845 | name = nil;
846 | value = nil;
847 |
848 | // start looking for next attribute
849 | mode = TBXML_ATTRIBUTE_NAME_START;
850 | }
851 | break;
852 | // look for end of cdata
853 | case TBXML_ATTRIBUTE_CDATA_END:
854 | if (*chr == ']') {
855 | if (strncmp(chr, "]]>", 3) == 0) {
856 | mode = TBXML_ATTRIBUTE_VALUE_END;
857 | }
858 | }
859 | break;
860 | default:
861 | break;
862 | }
863 | }
864 | }
865 |
866 | // if tag is not self closing, set parent to current element
867 | if (!selfClosingElement) {
868 | // set text on element to element end+1
869 | if (*(elementEnd+1) != '>')
870 | xmlElement->text = elementEnd+1;
871 |
872 | parentXMLElement = xmlElement;
873 | }
874 |
875 | // start looking for next element after end of current element
876 | elementStart = elementEnd+1;
877 | }
878 | }
879 |
880 | // Deallocate used memory
881 | - (void) dealloc {
882 |
883 | if (bytes) {
884 | free(bytes);
885 | bytes = nil;
886 | }
887 |
888 | while (currentElementBuffer) {
889 | if (currentElementBuffer->elements)
890 | free(currentElementBuffer->elements);
891 |
892 | if (currentElementBuffer->previous) {
893 | currentElementBuffer = currentElementBuffer->previous;
894 | free(currentElementBuffer->next);
895 | } else {
896 | free(currentElementBuffer);
897 | currentElementBuffer = 0;
898 | }
899 | }
900 |
901 | while (currentAttributeBuffer) {
902 | if (currentAttributeBuffer->attributes)
903 | free(currentAttributeBuffer->attributes);
904 |
905 | if (currentAttributeBuffer->previous) {
906 | currentAttributeBuffer = currentAttributeBuffer->previous;
907 | free(currentAttributeBuffer->next);
908 | } else {
909 | free(currentAttributeBuffer);
910 | currentAttributeBuffer = 0;
911 | }
912 | }
913 |
914 | #ifndef ARC_ENABLED
915 | [super dealloc];
916 | #endif
917 | }
918 |
919 | - (TBXMLElement*) nextAvailableElement {
920 | currentElement++;
921 |
922 | if (!currentElementBuffer) {
923 | currentElementBuffer = calloc(1, sizeof(TBXMLElementBuffer));
924 | currentElementBuffer->elements = (TBXMLElement*)calloc(1,sizeof(TBXMLElement)*MAX_ELEMENTS);
925 | currentElement = 0;
926 | rootXMLElement = ¤tElementBuffer->elements[currentElement];
927 | } else if (currentElement >= MAX_ELEMENTS) {
928 | currentElementBuffer->next = calloc(1, sizeof(TBXMLElementBuffer));
929 | currentElementBuffer->next->previous = currentElementBuffer;
930 | currentElementBuffer = currentElementBuffer->next;
931 | currentElementBuffer->elements = (TBXMLElement*)calloc(1,sizeof(TBXMLElement)*MAX_ELEMENTS);
932 | currentElement = 0;
933 | }
934 |
935 | return ¤tElementBuffer->elements[currentElement];
936 | }
937 |
938 | - (TBXMLAttribute*) nextAvailableAttribute {
939 | currentAttribute++;
940 |
941 | if (!currentAttributeBuffer) {
942 | currentAttributeBuffer = calloc(1, sizeof(TBXMLAttributeBuffer));
943 | currentAttributeBuffer->attributes = (TBXMLAttribute*)calloc(MAX_ATTRIBUTES,sizeof(TBXMLAttribute));
944 | currentAttribute = 0;
945 | } else if (currentAttribute >= MAX_ATTRIBUTES) {
946 | currentAttributeBuffer->next = calloc(1, sizeof(TBXMLAttributeBuffer));
947 | currentAttributeBuffer->next->previous = currentAttributeBuffer;
948 | currentAttributeBuffer = currentAttributeBuffer->next;
949 | currentAttributeBuffer->attributes = (TBXMLAttribute*)calloc(MAX_ATTRIBUTES,sizeof(TBXMLAttribute));
950 | currentAttribute = 0;
951 | }
952 |
953 | return ¤tAttributeBuffer->attributes[currentAttribute];
954 | }
955 |
956 | @end
957 |
--------------------------------------------------------------------------------
/TBXML-Headers/TBXML+Compression.h:
--------------------------------------------------------------------------------
1 | @interface NSData (TBXML_Compression)
2 |
3 | // ================================================================================================
4 | // Created by Tom Bradley on 21/10/2009.
5 | // Version 1.5
6 | //
7 | // Copyright 2012 71Squared All rights reserved.
8 | //
9 | // Permission is hereby granted, free of charge, to any person obtaining a copy
10 | // of this software and associated documentation files (the "Software"), to deal
11 | // in the Software without restriction, including without limitation the rights
12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 | // copies of the Software, and to permit persons to whom the Software is
14 | // furnished to do so, subject to the following conditions:
15 | //
16 | // The above copyright notice and this permission notice shall be included in
17 | // all copies or substantial portions of the Software.
18 | //
19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 | // THE SOFTWARE.
26 | // ================================================================================================
27 |
28 | + (NSData *) dataWithUncompressedContentsOfFile:(NSString *)aFile;
29 |
30 |
31 |
32 | // ================================================================================================
33 | // base64.h
34 | // ViewTransitions
35 | //
36 | // Created by Neo on 5/11/08.
37 | // Copyright 2008 Kaliware, LLC. All rights reserved.
38 | //
39 | // FOUND HERE http://idevkit.com/forums/tutorials-code-samples-sdk/8-nsdata-base64-extension.html
40 | // ================================================================================================
41 | + (NSData *) newDataWithBase64EncodedString:(NSString *) string;
42 | - (id) initWithBase64EncodedString:(NSString *) string;
43 |
44 | - (NSString *) base64Encoding;
45 | - (NSString *) base64EncodingWithLineLength:(unsigned int) lineLength;
46 |
47 |
48 |
49 | // ================================================================================================
50 | // NSData+gzip.h
51 | // Drip
52 | //
53 | // Created by Nur Monson on 8/21/07.
54 | // Copyright 2007 theidiotproject. All rights reserved.
55 | //
56 | // FOUND HERE http://code.google.com/p/drop-osx/source/browse/trunk/Source/NSData%2Bgzip.h
57 | // ================================================================================================
58 | - (NSData *)gzipDeflate;
59 | - (NSData *)gzipInflate;
60 |
61 |
62 |
63 | @end
--------------------------------------------------------------------------------
/TBXML-Headers/TBXML+HTTP.h:
--------------------------------------------------------------------------------
1 | //
2 | // TBXML+HTTP.h
3 | //
4 | // Created by Tom Bradley on 29/01/2011.
5 | // Copyright 2012 71Squared All rights reserved.
6 | //
7 |
8 | #import "TBXML.h"
9 |
10 | typedef void (^TBXMLAsyncRequestSuccessBlock)(NSData *,NSURLResponse *);
11 | typedef void (^TBXMLAsyncRequestFailureBlock)(NSData *,NSError *);
12 |
13 | @interface NSMutableURLRequest (TBXML_HTTP)
14 |
15 | + (NSMutableURLRequest*) tbxmlGetRequestWithURL:(NSURL*)url;
16 | + (NSMutableURLRequest*) tbxmlPostRequestWithURL:(NSURL*)url parameters:(NSDictionary*)parameters;
17 |
18 | @end
19 |
20 |
21 | @interface NSURLConnection (TBXML_HTTP)
22 |
23 | + (void)tbxmlAsyncRequest:(NSURLRequest *)request success:(TBXMLAsyncRequestSuccessBlock)successBlock failure:(TBXMLAsyncRequestFailureBlock)failureBlock;
24 |
25 | @end
26 |
27 |
28 | @interface TBXML (TBXML_HTTP)
29 |
30 | + (id)newTBXMLWithURL:(NSURL*)aURL success:(TBXMLSuccessBlock)successBlock failure:(TBXMLFailureBlock)failureBlock;
31 | - (id)initWithURL:(NSURL*)aURL success:(TBXMLSuccessBlock)successBlock failure:(TBXMLFailureBlock)failureBlock;
32 |
33 | @end
34 |
35 |
36 |
--------------------------------------------------------------------------------
/TBXML-Headers/TBXML.h:
--------------------------------------------------------------------------------
1 | // ================================================================================================
2 | // TBXML.h
3 | // Fast processing of XML files
4 | //
5 | // ================================================================================================
6 | // Created by Tom Bradley on 21/10/2009.
7 | // Version 1.5
8 | //
9 | // Copyright 2012 71Squared All rights reserved.b
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy
12 | // of this software and associated documentation files (the "Software"), to deal
13 | // in the Software without restriction, including without limitation the rights
14 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 | // copies of the Software, and to permit persons to whom the Software is
16 | // furnished to do so, subject to the following conditions:
17 | //
18 | // The above copyright notice and this permission notice shall be included in
19 | // all copies or substantial portions of the Software.
20 | //
21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 | // THE SOFTWARE.
28 | // ================================================================================================
29 |
30 | @class TBXML;
31 |
32 |
33 | // ================================================================================================
34 | // Error Codes
35 | // ================================================================================================
36 | enum TBXMLErrorCodes {
37 | D_TBXML_SUCCESS = 0,
38 |
39 | D_TBXML_DATA_NIL,
40 | D_TBXML_DECODE_FAILURE,
41 | D_TBXML_MEMORY_ALLOC_FAILURE,
42 | D_TBXML_FILE_NOT_FOUND_IN_BUNDLE,
43 |
44 | D_TBXML_ELEMENT_IS_NIL,
45 | D_TBXML_ELEMENT_NAME_IS_NIL,
46 | D_TBXML_ELEMENT_NOT_FOUND,
47 | D_TBXML_ELEMENT_TEXT_IS_NIL,
48 | D_TBXML_ATTRIBUTE_IS_NIL,
49 | D_TBXML_ATTRIBUTE_NAME_IS_NIL,
50 | D_TBXML_ATTRIBUTE_NOT_FOUND,
51 | D_TBXML_PARAM_NAME_IS_NIL
52 | };
53 |
54 |
55 | // ================================================================================================
56 | // Defines
57 | // ================================================================================================
58 | #define D_TBXML_DOMAIN @"com.71squared.tbxml"
59 |
60 | #define MAX_ELEMENTS 100
61 | #define MAX_ATTRIBUTES 100
62 |
63 | #define TBXML_ATTRIBUTE_NAME_START 0
64 | #define TBXML_ATTRIBUTE_NAME_END 1
65 | #define TBXML_ATTRIBUTE_VALUE_START 2
66 | #define TBXML_ATTRIBUTE_VALUE_END 3
67 | #define TBXML_ATTRIBUTE_CDATA_END 4
68 |
69 | // ================================================================================================
70 | // Structures
71 | // ================================================================================================
72 |
73 | /** The TBXMLAttribute structure holds information about a single XML attribute. The structure holds the attribute name, value and next sibling attribute. This structure allows us to create a linked list of attributes belonging to a specific element.
74 | */
75 | typedef struct _TBXMLAttribute {
76 | char * name;
77 | char * value;
78 | struct _TBXMLAttribute * next;
79 | } TBXMLAttribute;
80 |
81 |
82 |
83 | /** The TBXMLElement structure holds information about a single XML element. The structure holds the element name & text along with pointers to the first attribute, parent element, first child element and first sibling element. Using this structure, we can create a linked list of TBXMLElements to map out an entire XML file.
84 | */
85 | typedef struct _TBXMLElement {
86 | char * name;
87 | char * text;
88 |
89 | TBXMLAttribute * firstAttribute;
90 |
91 | struct _TBXMLElement * parentElement;
92 |
93 | struct _TBXMLElement * firstChild;
94 | struct _TBXMLElement * currentChild;
95 |
96 | struct _TBXMLElement * nextSibling;
97 | struct _TBXMLElement * previousSibling;
98 |
99 | } TBXMLElement;
100 |
101 | /** The TBXMLElementBuffer is a structure that holds a buffer of TBXMLElements. When the buffer of elements is used, an additional buffer is created and linked to the previous one. This allows for efficient memory allocation/deallocation elements.
102 | */
103 | typedef struct _TBXMLElementBuffer {
104 | TBXMLElement * elements;
105 | struct _TBXMLElementBuffer * next;
106 | struct _TBXMLElementBuffer * previous;
107 | } TBXMLElementBuffer;
108 |
109 |
110 |
111 | /** The TBXMLAttributeBuffer is a structure that holds a buffer of TBXMLAttributes. When the buffer of attributes is used, an additional buffer is created and linked to the previous one. This allows for efficient memeory allocation/deallocation of attributes.
112 | */
113 | typedef struct _TBXMLAttributeBuffer {
114 | TBXMLAttribute * attributes;
115 | struct _TBXMLAttributeBuffer * next;
116 | struct _TBXMLAttributeBuffer * previous;
117 | } TBXMLAttributeBuffer;
118 |
119 |
120 | // ================================================================================================
121 | // Block Callbacks
122 | // ================================================================================================
123 | typedef void (^TBXMLSuccessBlock)(TBXML *tbxml);
124 | typedef void (^TBXMLFailureBlock)(TBXML *tbxml, NSError *error);
125 | typedef void (^TBXMLIterateBlock)(TBXMLElement *element);
126 | typedef void (^TBXMLIterateAttributeBlock)(TBXMLAttribute *attribute, NSString *attributeName, NSString *attributeValue);
127 |
128 |
129 | // ================================================================================================
130 | // TBXML Public Interface
131 | // ================================================================================================
132 |
133 | @interface TBXML : NSObject {
134 |
135 | @private
136 | TBXMLElement * rootXMLElement;
137 |
138 | TBXMLElementBuffer * currentElementBuffer;
139 | TBXMLAttributeBuffer * currentAttributeBuffer;
140 |
141 | long currentElement;
142 | long currentAttribute;
143 |
144 | char * bytes;
145 | long bytesLength;
146 | }
147 |
148 |
149 | @property (nonatomic, readonly) TBXMLElement * rootXMLElement;
150 |
151 | + (id)newTBXMLWithXMLString:(NSString*)aXMLString error:(NSError **)error;
152 | + (id)newTBXMLWithXMLData:(NSData*)aData error:(NSError **)error;
153 | + (id)newTBXMLWithXMLFile:(NSString*)aXMLFile error:(NSError **)error;
154 | + (id)newTBXMLWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension error:(NSError **)error;
155 |
156 | + (id)newTBXMLWithXMLString:(NSString*)aXMLString __attribute__((deprecated));
157 | + (id)newTBXMLWithXMLData:(NSData*)aData __attribute__((deprecated));
158 | + (id)newTBXMLWithXMLFile:(NSString*)aXMLFile __attribute__((deprecated));
159 | + (id)newTBXMLWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension __attribute__((deprecated));
160 |
161 |
162 | - (id)initWithXMLString:(NSString*)aXMLString error:(NSError **)error;
163 | - (id)initWithXMLData:(NSData*)aData error:(NSError **)error;
164 | - (id)initWithXMLFile:(NSString*)aXMLFile error:(NSError **)error;
165 | - (id)initWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension error:(NSError **)error;
166 |
167 | - (id)initWithXMLString:(NSString*)aXMLString __attribute__((deprecated));
168 | - (id)initWithXMLData:(NSData*)aData __attribute__((deprecated));
169 | - (id)initWithXMLFile:(NSString*)aXMLFile __attribute__((deprecated));
170 | - (id)initWithXMLFile:(NSString*)aXMLFile fileExtension:(NSString*)aFileExtension __attribute__((deprecated));
171 |
172 |
173 | - (int) decodeData:(NSData*)data;
174 | - (int) decodeData:(NSData*)data withError:(NSError **)error;
175 |
176 | @end
177 |
178 | // ================================================================================================
179 | // TBXML Static Functions Interface
180 | // ================================================================================================
181 |
182 | @interface TBXML (StaticFunctions)
183 |
184 | + (NSString*) elementName:(TBXMLElement*)aXMLElement;
185 | + (NSString*) elementName:(TBXMLElement*)aXMLElement error:(NSError **)error;
186 | + (NSString*) textForElement:(TBXMLElement*)aXMLElement;
187 | + (NSString*) textForElement:(TBXMLElement*)aXMLElement error:(NSError **)error;
188 | + (NSString*) valueOfAttributeNamed:(NSString *)aName forElement:(TBXMLElement*)aXMLElement;
189 | + (NSString*) valueOfAttributeNamed:(NSString *)aName forElement:(TBXMLElement*)aXMLElement error:(NSError **)error;
190 |
191 | + (NSString*) attributeName:(TBXMLAttribute*)aXMLAttribute;
192 | + (NSString*) attributeName:(TBXMLAttribute*)aXMLAttribute error:(NSError **)error;
193 | + (NSString*) attributeValue:(TBXMLAttribute*)aXMLAttribute;
194 | + (NSString*) attributeValue:(TBXMLAttribute*)aXMLAttribute error:(NSError **)error;
195 |
196 | + (TBXMLElement*) nextSiblingNamed:(NSString*)aName searchFromElement:(TBXMLElement*)aXMLElement;
197 | + (TBXMLElement*) childElementNamed:(NSString*)aName parentElement:(TBXMLElement*)aParentXMLElement;
198 |
199 | + (TBXMLElement*) nextSiblingNamed:(NSString*)aName searchFromElement:(TBXMLElement*)aXMLElement error:(NSError **)error;
200 | + (TBXMLElement*) childElementNamed:(NSString*)aName parentElement:(TBXMLElement*)aParentXMLElement error:(NSError **)error;
201 |
202 | /** Iterate through all elements found using query.
203 |
204 | Inspiration taken from John Blanco's RaptureXML https://github.com/ZaBlanc/RaptureXML
205 | */
206 | + (void)iterateElementsForQuery:(NSString *)query fromElement:(TBXMLElement *)anElement withBlock:(TBXMLIterateBlock)iterateBlock;
207 | + (void)iterateAttributesOfElement:(TBXMLElement *)anElement withBlock:(TBXMLIterateAttributeBlock)iterateBlock;
208 |
209 |
210 | @end
211 |
--------------------------------------------------------------------------------
/TBXML-Support/TBXML-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'asfd' target in the 'asfd' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 |
8 |
9 |
10 | // define some LLVM3 macros if the code is compiled with a different compiler (ie LLVMGCC42)
11 | #ifndef __has_feature
12 | #define __has_feature(x) 0
13 | #endif
14 |
15 | #ifndef __has_extension
16 | #define __has_extension __has_feature // Compatibility with pre-3.0 compilers.
17 | #endif
18 |
19 | #if __has_feature(objc_arc) && __clang_major__ >= 3
20 | #define ARC_ENABLED 1
21 | #endif // __has_feature(objc_arc)
22 |
23 |
24 | // not using clang LLVM compiler, or LLVM version is not 3.x
25 | #if !defined(__clang__) || __clang_major__ < 3
26 |
27 | #ifndef __bridge
28 | #define __bridge
29 | #endif
30 |
31 | #ifndef __bridge_retained
32 | #define __bridge_retained
33 | #endif
34 |
35 | #ifndef __bridge_transfer
36 | #define __bridge_transfer
37 | #endif
38 |
39 | #ifndef __autoreleasing
40 | #define __autoreleasing
41 | #endif
42 |
43 | #ifndef __strong
44 | #define __strong
45 | #endif
46 |
47 | #ifndef __weak
48 | #define __weak
49 | #endif
50 |
51 | #ifndef __unsafe_unretained
52 | #define __unsafe_unretained
53 | #endif
54 |
55 | #endif // __clang_major__ < 3
56 |
57 | #endif
58 |
--------------------------------------------------------------------------------
/TBXML-Support/TBXML-iOS-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'TBXML-iOS' target in the 'TBXML-iOS' project
3 | //
4 |
5 | #ifdef __OBJC__
6 | #import
7 | #endif
8 |
--------------------------------------------------------------------------------
/TBXML-Tests/Supporting Files/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/TBXML-Tests/Supporting Files/TBXMLTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.71Squared.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/TBXML-Tests/Supporting Files/books.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Harry potter thinks he is an ordinary boy - until he is rescued from a beetle-eyed giant of a man, enrolls at Hogwarts School of Witchcraft and Wizardry, learns to play quidditch and does battle in a deadly duel.
7 |
8 |
9 |
10 |
11 | When the Chamber of Secrets is opened again at the Hogwarts School for Witchcraft and Wizardry, second-year student Harry Potter finds himself in danger from a dark power that has once more been released on the school.
12 |
13 |
14 |
15 |
16 | Harry Potter, along with his friends, Ron and Hermione, is about to start his third year at Hogwarts School of Witchcraft and Wizardry. Harry can't wait to get back to school after the summer holidays. (Who wouldn't if they lived with the horrible Dursleys?) But when Harry gets to Hogwarts, the atmosphere is tense. There's an escaped mass murderer on the the loose, and the sinister prison guards of Azkaban have been called in to guard the school.
17 |
18 |
19 |
20 |
21 |
22 |
23 | Join Douglas Adams's hapless hero Arthur Dent as he travels the galaxy with his intrepid pal Ford Prefect, getting into horrible messes and generally wreaking hilarious havoc.
24 |
25 |
26 |
27 |
28 | Arthur and Ford, having survived the destruction of Earth by surreptitiously hitching a ride on a Vogon constructor ship, have been kicked off that ship by its commander. Now they find themselves aboard a stolen Improbability Drive ship commanded by Beeblebrox, ex-president of the Imperial Galactic Government and full-time thief.
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/TBXML-Tests/TBXMLTests.h:
--------------------------------------------------------------------------------
1 | //
2 | // TBXMLTests.h
3 | // TBXMLTests
4 | //
5 | // Created by Tom Bradley on 29/01/2012.
6 | // Copyright (c) 2012 71 Squared. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface TBXMLTests : SenTestCase
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/TBXML-Tests/TBXMLTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // TBXMLTests.m
3 | // TBXMLTests
4 | //
5 | // Created by Tom Bradley on 29/01/2012.
6 | // Copyright (c) 2012 71 Squared. All rights reserved.
7 | //
8 |
9 | #import "TBXMLTests.h"
10 | #import "TBXML.h"
11 |
12 | @implementation TBXMLTests
13 |
14 | - (void)setUp
15 | {
16 | [super setUp];
17 |
18 | // Set-up code here.
19 | }
20 |
21 | - (void)tearDown
22 | {
23 | // Tear-down code here.
24 |
25 | [super tearDown];
26 | }
27 |
28 | - (void)testLoadXMLResourceFailure
29 | {
30 | NSError *error;
31 | [TBXML newTBXMLWithXMLFile:@"some-file-that-doesnt-exist.xml" error:&error];
32 |
33 | STAssertTrue([error code] == D_TBXML_FILE_NOT_FOUND_IN_BUNDLE, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
34 | }
35 |
36 | - (void)testLoadXMLResource
37 | {
38 | NSError *error;
39 | [TBXML newTBXMLWithXMLFile:@"books.xml" error:&error];
40 |
41 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
42 | }
43 |
44 | - (void)testDataIsNil
45 | {
46 | NSData *data = nil;
47 |
48 | NSError *error;
49 | [TBXML newTBXMLWithXMLData:data error:&error];
50 |
51 | STAssertTrue([error code] == D_TBXML_DATA_NIL, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
52 | }
53 |
54 | - (void)testDecodeError
55 | {
56 | NSString *string = @"asdfaf uhaluhlasdh sf a";
57 |
58 | NSError *error;
59 | [TBXML newTBXMLWithXMLString:string error:&error];
60 |
61 | STAssertTrue([error code] == D_TBXML_DECODE_FAILURE, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
62 | }
63 |
64 | - (void)testDecodeError2
65 | {
66 | NSString *string = @"<>";
88 |
89 | NSError *error;
90 | TBXML * tbxml = [TBXML newTBXMLWithXMLString:string error:&error];
91 |
92 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
93 |
94 | [TBXML elementName:tbxml.rootXMLElement error:&error];
95 |
96 | STAssertTrue([error code] == D_TBXML_ELEMENT_NAME_IS_NIL, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
97 |
98 | }
99 |
100 | - (void)testElementNotFound
101 | {
102 | NSString *string = @"";
103 |
104 | NSError *error;
105 | TBXML * tbxml = [TBXML newTBXMLWithXMLString:string error:&error];
106 |
107 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
108 |
109 | [TBXML childElementNamed:@"anElement" parentElement:tbxml.rootXMLElement error:&error];
110 |
111 | STAssertTrue([error code] == D_TBXML_ELEMENT_NOT_FOUND, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
112 |
113 | }
114 |
115 | - (void)testSiblingElementNotFound
116 | {
117 | NSString *string = @"";
118 |
119 | NSError *error;
120 | TBXML * tbxml = [TBXML newTBXMLWithXMLString:string error:&error];
121 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
122 |
123 | TBXMLElement * element = [TBXML childElementNamed:@"child" parentElement:tbxml.rootXMLElement error:&error];
124 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
125 |
126 | [TBXML nextSiblingNamed:@"child" searchFromElement:element error:&error];
127 | STAssertTrue([error code] == D_TBXML_ELEMENT_NOT_FOUND, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
128 | }
129 |
130 | - (void)testAttributeNotFound
131 | {
132 | NSString *string = @"";
133 |
134 | NSError *error;
135 | TBXML * tbxml = [TBXML newTBXMLWithXMLString:string error:&error];
136 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
137 |
138 | TBXMLElement * element = [TBXML childElementNamed:@"child" parentElement:tbxml.rootXMLElement error:&error];
139 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
140 |
141 | [TBXML valueOfAttributeNamed:@"someOtherAttrib" forElement:element error:&error];
142 | STAssertTrue([error code] == D_TBXML_ATTRIBUTE_NOT_FOUND, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
143 | }
144 |
145 | - (void)testAttributeNameIsNil
146 | {
147 | NSString *string = @"";
148 |
149 | NSError *error;
150 | TBXML * tbxml = [TBXML newTBXMLWithXMLString:string error:&error];
151 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
152 |
153 | TBXMLElement * element = [TBXML childElementNamed:@"child" parentElement:tbxml.rootXMLElement error:&error];
154 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
155 |
156 | [TBXML valueOfAttributeNamed:nil forElement:element error:&error];
157 | STAssertTrue([error code] == D_TBXML_ATTRIBUTE_NAME_IS_NIL, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
158 | }
159 |
160 | - (void)testTextIsNil
161 | {
162 | NSString *string = @"";
163 |
164 | NSError *error;
165 | TBXML * tbxml = [TBXML newTBXMLWithXMLString:string error:&error];
166 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
167 |
168 | TBXMLElement * element = [TBXML childElementNamed:@"child" parentElement:tbxml.rootXMLElement error:&error];
169 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
170 |
171 | [TBXML textForElement:element error:&error];
172 | STAssertTrue([error code] == D_TBXML_ELEMENT_TEXT_IS_NIL, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
173 | }
174 |
175 | - (void)testSiblingElement
176 | {
177 | NSString *string = @"";
178 |
179 | NSError *error;
180 | TBXML * tbxml = [TBXML newTBXMLWithXMLString:string error:&error];
181 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
182 |
183 | TBXMLElement * element = [TBXML childElementNamed:@"child" parentElement:tbxml.rootXMLElement error:&error];
184 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
185 |
186 | TBXMLElement * childElement = [TBXML nextSiblingNamed:@"child" searchFromElement:element error:&error];
187 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
188 |
189 | NSString * name = [TBXML elementName:childElement error:&error];
190 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
191 |
192 | STAssertTrue([name isEqualToString:@"child"], @"Incorrect Element Returned %@", name);
193 | }
194 |
195 | - (void)testElementText
196 | {
197 | NSString *string = @"Element Text";
198 |
199 | NSError *error;
200 | TBXML * tbxml = [TBXML newTBXMLWithXMLString:string error:&error];
201 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
202 |
203 | TBXMLElement * element = [TBXML childElementNamed:@"child" parentElement:tbxml.rootXMLElement error:&error];
204 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
205 |
206 | NSString * text = [TBXML textForElement:element error:&error];
207 | STAssertTrue([text isEqualToString:@"Element Text"], @"Incorrect Element Text %@", text);
208 | }
209 |
210 | - (void)testNoErrorVars
211 | {
212 | NSString *string = @"Element Text";
213 |
214 | TBXML * tbxml = [TBXML newTBXMLWithXMLString:string error:nil];
215 | STAssertTrue(tbxml.rootXMLElement != nil, @"Root element is nil");
216 |
217 | TBXMLElement * element = [TBXML childElementNamed:@"child" parentElement:tbxml.rootXMLElement];
218 | STAssertTrue(tbxml.rootXMLElement != nil, @"Element is nil");
219 |
220 | NSString * text = [TBXML textForElement:element];
221 | STAssertTrue([text isEqualToString:@"Element Text"], @"Incorrect Element Text %@", text);
222 | }
223 |
224 | - (void)testRootNodeAttributeEmpty
225 | {
226 | NSString *string = @"";
227 |
228 | NSError *error;
229 | TBXML * tbxml = [TBXML newTBXMLWithXMLString:string error:nil];
230 | STAssertTrue(tbxml.rootXMLElement != nil, @"Root element is nil");
231 |
232 | NSString * value = [TBXML valueOfAttributeNamed:@"MSG" forElement:tbxml.rootXMLElement error:&error];
233 | STAssertNil(error, @"Incorrect Error Returned %@ %@", [error localizedDescription], [error userInfo]);
234 | STAssertTrue([value isEqualToString:@""], @"Returned string is not empty");
235 | }
236 |
237 | - (void)testDeprecated_tbxmlWithXMLData
238 | {
239 | NSString *string = @"abcdefg";
240 | NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
241 |
242 | #pragma clang diagnostic push
243 | #pragma clang diagnostic ignored "-Wdeprecated-declarations"
244 |
245 | TBXML *tbxml = [TBXML newTBXMLWithXMLData:data];
246 | STAssertTrue(tbxml.rootXMLElement == nil, @"Should have failed to parse");
247 |
248 | string = @"Element Text";
249 | data = [string dataUsingEncoding:NSUTF8StringEncoding];
250 |
251 | tbxml = [TBXML newTBXMLWithXMLData:data];
252 | STAssertTrue(tbxml.rootXMLElement != nil, @"Should have parsed successfully");
253 |
254 | #pragma clang diagnostic pop
255 |
256 | }
257 |
258 | @end
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
--------------------------------------------------------------------------------
/TBXML.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 8290352714D9F5B200ACF7E4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8290352614D9F5B200ACF7E4 /* Foundation.framework */; };
11 | 8290353414D9F5B200ACF7E4 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 829FA0B114D5B52A00D18697 /* SenTestingKit.framework */; };
12 | 8290353714D9F5B200ACF7E4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8290352614D9F5B200ACF7E4 /* Foundation.framework */; };
13 | 8290353A14D9F5B200ACF7E4 /* libTBXML-iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8290352514D9F5B200ACF7E4 /* libTBXML-iOS.a */; };
14 | 8290354B14D9F6B100ACF7E4 /* TBXML+Compression.m in Sources */ = {isa = PBXBuildFile; fileRef = 829FA0C914D5B55D00D18697 /* TBXML+Compression.m */; };
15 | 8290354C14D9F6B100ACF7E4 /* TBXML+HTTP.m in Sources */ = {isa = PBXBuildFile; fileRef = 829FA0CA14D5B55D00D18697 /* TBXML+HTTP.m */; };
16 | 8290354D14D9F6B100ACF7E4 /* TBXML.m in Sources */ = {isa = PBXBuildFile; fileRef = 829FA0CB14D5B55D00D18697 /* TBXML.m */; };
17 | 8290354E14D9F6E100ACF7E4 /* TBXML+Compression.h in Headers */ = {isa = PBXBuildFile; fileRef = 829FA0CD14D5B55D00D18697 /* TBXML+Compression.h */; settings = {ATTRIBUTES = (Public, ); }; };
18 | 8290354F14D9F6E100ACF7E4 /* TBXML+HTTP.h in Headers */ = {isa = PBXBuildFile; fileRef = 829FA0CE14D5B55D00D18697 /* TBXML+HTTP.h */; settings = {ATTRIBUTES = (Public, ); }; };
19 | 8290355014D9F6E100ACF7E4 /* TBXML.h in Headers */ = {isa = PBXBuildFile; fileRef = 829FA0CF14D5B55D00D18697 /* TBXML.h */; settings = {ATTRIBUTES = (Public, ); }; };
20 | 8290355E14D9F8DA00ACF7E4 /* books.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8290355914D9F8BF00ACF7E4 /* books.xml */; };
21 | 8290355F14D9F8DD00ACF7E4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8290355A14D9F8BF00ACF7E4 /* InfoPlist.strings */; };
22 | 8290356014D9F8E300ACF7E4 /* TBXMLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8290355D14D9F8BF00ACF7E4 /* TBXMLTests.m */; };
23 | 8290356114D9F8F100ACF7E4 /* TBXMLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8290355D14D9F8BF00ACF7E4 /* TBXMLTests.m */; };
24 | 8290356214D9F8F300ACF7E4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8290355A14D9F8BF00ACF7E4 /* InfoPlist.strings */; };
25 | 8290356314D9F8F600ACF7E4 /* books.xml in Resources */ = {isa = PBXBuildFile; fileRef = 8290355914D9F8BF00ACF7E4 /* books.xml */; };
26 | 829FA0A014D5B52A00D18697 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 829FA09F14D5B52A00D18697 /* Cocoa.framework */; };
27 | 829FA0B214D5B52A00D18697 /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 829FA0B114D5B52A00D18697 /* SenTestingKit.framework */; };
28 | 829FA0B314D5B52A00D18697 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 829FA09F14D5B52A00D18697 /* Cocoa.framework */; };
29 | 829FA0B614D5B52A00D18697 /* libTBXML.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 829FA09C14D5B52A00D18697 /* libTBXML.a */; };
30 | 829FA0D014D5B55D00D18697 /* TBXML+Compression.m in Sources */ = {isa = PBXBuildFile; fileRef = 829FA0C914D5B55D00D18697 /* TBXML+Compression.m */; };
31 | 829FA0D114D5B55D00D18697 /* TBXML+HTTP.m in Sources */ = {isa = PBXBuildFile; fileRef = 829FA0CA14D5B55D00D18697 /* TBXML+HTTP.m */; };
32 | 829FA0D214D5B55D00D18697 /* TBXML.m in Sources */ = {isa = PBXBuildFile; fileRef = 829FA0CB14D5B55D00D18697 /* TBXML.m */; };
33 | /* End PBXBuildFile section */
34 |
35 | /* Begin PBXContainerItemProxy section */
36 | 8290353814D9F5B200ACF7E4 /* PBXContainerItemProxy */ = {
37 | isa = PBXContainerItemProxy;
38 | containerPortal = 829FA09314D5B52A00D18697 /* Project object */;
39 | proxyType = 1;
40 | remoteGlobalIDString = 8290352414D9F5B200ACF7E4;
41 | remoteInfo = "TBXML-iOS";
42 | };
43 | 829FA0B414D5B52A00D18697 /* PBXContainerItemProxy */ = {
44 | isa = PBXContainerItemProxy;
45 | containerPortal = 829FA09314D5B52A00D18697 /* Project object */;
46 | proxyType = 1;
47 | remoteGlobalIDString = 829FA09B14D5B52A00D18697;
48 | remoteInfo = TBXML;
49 | };
50 | /* End PBXContainerItemProxy section */
51 |
52 | /* Begin PBXFileReference section */
53 | 8290352514D9F5B200ACF7E4 /* libTBXML-iOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libTBXML-iOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
54 | 8290352614D9F5B200ACF7E4 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
55 | 8290353314D9F5B200ACF7E4 /* TBXML-iOSTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "TBXML-iOSTests.octest"; sourceTree = BUILT_PRODUCTS_DIR; };
56 | 8290355514D9F85C00ACF7E4 /* TBXML-iOS-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TBXML-iOS-Prefix.pch"; sourceTree = ""; };
57 | 8290355614D9F85C00ACF7E4 /* TBXML-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TBXML-Prefix.pch"; sourceTree = ""; };
58 | 8290355914D9F8BF00ACF7E4 /* books.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = books.xml; sourceTree = ""; };
59 | 8290355A14D9F8BF00ACF7E4 /* InfoPlist.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = InfoPlist.strings; sourceTree = ""; };
60 | 8290355B14D9F8BF00ACF7E4 /* TBXMLTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TBXMLTests-Info.plist"; sourceTree = ""; };
61 | 8290355C14D9F8BF00ACF7E4 /* TBXMLTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TBXMLTests.h; sourceTree = ""; };
62 | 8290355D14D9F8BF00ACF7E4 /* TBXMLTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TBXMLTests.m; sourceTree = ""; };
63 | 829FA09C14D5B52A00D18697 /* libTBXML.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTBXML.a; sourceTree = BUILT_PRODUCTS_DIR; };
64 | 829FA09F14D5B52A00D18697 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
65 | 829FA0A214D5B52A00D18697 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
66 | 829FA0A314D5B52A00D18697 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
67 | 829FA0A414D5B52A00D18697 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
68 | 829FA0B014D5B52A00D18697 /* TBXMLTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TBXMLTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
69 | 829FA0B114D5B52A00D18697 /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
70 | 829FA0C914D5B55D00D18697 /* TBXML+Compression.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TBXML+Compression.m"; sourceTree = ""; };
71 | 829FA0CA14D5B55D00D18697 /* TBXML+HTTP.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TBXML+HTTP.m"; sourceTree = ""; };
72 | 829FA0CB14D5B55D00D18697 /* TBXML.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TBXML.m; sourceTree = ""; };
73 | 829FA0CD14D5B55D00D18697 /* TBXML+Compression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TBXML+Compression.h"; sourceTree = ""; };
74 | 829FA0CE14D5B55D00D18697 /* TBXML+HTTP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TBXML+HTTP.h"; sourceTree = ""; };
75 | 829FA0CF14D5B55D00D18697 /* TBXML.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TBXML.h; sourceTree = ""; };
76 | /* End PBXFileReference section */
77 |
78 | /* Begin PBXFrameworksBuildPhase section */
79 | 8290352214D9F5B200ACF7E4 /* Frameworks */ = {
80 | isa = PBXFrameworksBuildPhase;
81 | buildActionMask = 2147483647;
82 | files = (
83 | 8290352714D9F5B200ACF7E4 /* Foundation.framework in Frameworks */,
84 | );
85 | runOnlyForDeploymentPostprocessing = 0;
86 | };
87 | 8290352F14D9F5B200ACF7E4 /* Frameworks */ = {
88 | isa = PBXFrameworksBuildPhase;
89 | buildActionMask = 2147483647;
90 | files = (
91 | 8290353414D9F5B200ACF7E4 /* SenTestingKit.framework in Frameworks */,
92 | 8290353714D9F5B200ACF7E4 /* Foundation.framework in Frameworks */,
93 | 8290353A14D9F5B200ACF7E4 /* libTBXML-iOS.a in Frameworks */,
94 | );
95 | runOnlyForDeploymentPostprocessing = 0;
96 | };
97 | 829FA09914D5B52A00D18697 /* Frameworks */ = {
98 | isa = PBXFrameworksBuildPhase;
99 | buildActionMask = 2147483647;
100 | files = (
101 | 829FA0A014D5B52A00D18697 /* Cocoa.framework in Frameworks */,
102 | );
103 | runOnlyForDeploymentPostprocessing = 0;
104 | };
105 | 829FA0AC14D5B52A00D18697 /* Frameworks */ = {
106 | isa = PBXFrameworksBuildPhase;
107 | buildActionMask = 2147483647;
108 | files = (
109 | 829FA0B214D5B52A00D18697 /* SenTestingKit.framework in Frameworks */,
110 | 829FA0B314D5B52A00D18697 /* Cocoa.framework in Frameworks */,
111 | 829FA0B614D5B52A00D18697 /* libTBXML.a in Frameworks */,
112 | );
113 | runOnlyForDeploymentPostprocessing = 0;
114 | };
115 | /* End PBXFrameworksBuildPhase section */
116 |
117 | /* Begin PBXGroup section */
118 | 8290355414D9F85C00ACF7E4 /* TBXML-Support */ = {
119 | isa = PBXGroup;
120 | children = (
121 | 8290355514D9F85C00ACF7E4 /* TBXML-iOS-Prefix.pch */,
122 | 8290355614D9F85C00ACF7E4 /* TBXML-Prefix.pch */,
123 | );
124 | path = "TBXML-Support";
125 | sourceTree = "";
126 | };
127 | 8290355714D9F8BF00ACF7E4 /* TBXML-Tests */ = {
128 | isa = PBXGroup;
129 | children = (
130 | 8290355814D9F8BF00ACF7E4 /* Supporting Files */,
131 | 8290355C14D9F8BF00ACF7E4 /* TBXMLTests.h */,
132 | 8290355D14D9F8BF00ACF7E4 /* TBXMLTests.m */,
133 | );
134 | path = "TBXML-Tests";
135 | sourceTree = "";
136 | };
137 | 8290355814D9F8BF00ACF7E4 /* Supporting Files */ = {
138 | isa = PBXGroup;
139 | children = (
140 | 8290355914D9F8BF00ACF7E4 /* books.xml */,
141 | 8290355A14D9F8BF00ACF7E4 /* InfoPlist.strings */,
142 | 8290355B14D9F8BF00ACF7E4 /* TBXMLTests-Info.plist */,
143 | );
144 | path = "Supporting Files";
145 | sourceTree = "";
146 | };
147 | 829FA09114D5B52A00D18697 = {
148 | isa = PBXGroup;
149 | children = (
150 | 829FA0C814D5B55D00D18697 /* TBXML-Code */,
151 | 829FA0CC14D5B55D00D18697 /* TBXML-Headers */,
152 | 8290355414D9F85C00ACF7E4 /* TBXML-Support */,
153 | 8290355714D9F8BF00ACF7E4 /* TBXML-Tests */,
154 | 829FA09E14D5B52A00D18697 /* Frameworks */,
155 | 829FA09D14D5B52A00D18697 /* Products */,
156 | );
157 | sourceTree = "";
158 | };
159 | 829FA09D14D5B52A00D18697 /* Products */ = {
160 | isa = PBXGroup;
161 | children = (
162 | 829FA09C14D5B52A00D18697 /* libTBXML.a */,
163 | 829FA0B014D5B52A00D18697 /* TBXMLTests.octest */,
164 | 8290352514D9F5B200ACF7E4 /* libTBXML-iOS.a */,
165 | 8290353314D9F5B200ACF7E4 /* TBXML-iOSTests.octest */,
166 | );
167 | name = Products;
168 | sourceTree = "";
169 | };
170 | 829FA09E14D5B52A00D18697 /* Frameworks */ = {
171 | isa = PBXGroup;
172 | children = (
173 | 829FA09F14D5B52A00D18697 /* Cocoa.framework */,
174 | 829FA0B114D5B52A00D18697 /* SenTestingKit.framework */,
175 | 8290352614D9F5B200ACF7E4 /* Foundation.framework */,
176 | 829FA0A114D5B52A00D18697 /* Other Frameworks */,
177 | );
178 | name = Frameworks;
179 | sourceTree = "";
180 | };
181 | 829FA0A114D5B52A00D18697 /* Other Frameworks */ = {
182 | isa = PBXGroup;
183 | children = (
184 | 829FA0A214D5B52A00D18697 /* AppKit.framework */,
185 | 829FA0A314D5B52A00D18697 /* CoreData.framework */,
186 | 829FA0A414D5B52A00D18697 /* Foundation.framework */,
187 | );
188 | name = "Other Frameworks";
189 | sourceTree = "";
190 | };
191 | 829FA0C814D5B55D00D18697 /* TBXML-Code */ = {
192 | isa = PBXGroup;
193 | children = (
194 | 829FA0C914D5B55D00D18697 /* TBXML+Compression.m */,
195 | 829FA0CA14D5B55D00D18697 /* TBXML+HTTP.m */,
196 | 829FA0CB14D5B55D00D18697 /* TBXML.m */,
197 | );
198 | path = "TBXML-Code";
199 | sourceTree = "";
200 | };
201 | 829FA0CC14D5B55D00D18697 /* TBXML-Headers */ = {
202 | isa = PBXGroup;
203 | children = (
204 | 829FA0CD14D5B55D00D18697 /* TBXML+Compression.h */,
205 | 829FA0CE14D5B55D00D18697 /* TBXML+HTTP.h */,
206 | 829FA0CF14D5B55D00D18697 /* TBXML.h */,
207 | );
208 | path = "TBXML-Headers";
209 | sourceTree = "";
210 | };
211 | /* End PBXGroup section */
212 |
213 | /* Begin PBXHeadersBuildPhase section */
214 | 8290352314D9F5B200ACF7E4 /* Headers */ = {
215 | isa = PBXHeadersBuildPhase;
216 | buildActionMask = 2147483647;
217 | files = (
218 | 8290355014D9F6E100ACF7E4 /* TBXML.h in Headers */,
219 | 8290354F14D9F6E100ACF7E4 /* TBXML+HTTP.h in Headers */,
220 | 8290354E14D9F6E100ACF7E4 /* TBXML+Compression.h in Headers */,
221 | );
222 | runOnlyForDeploymentPostprocessing = 0;
223 | };
224 | 829FA09A14D5B52A00D18697 /* Headers */ = {
225 | isa = PBXHeadersBuildPhase;
226 | buildActionMask = 2147483647;
227 | files = (
228 | );
229 | runOnlyForDeploymentPostprocessing = 0;
230 | };
231 | /* End PBXHeadersBuildPhase section */
232 |
233 | /* Begin PBXNativeTarget section */
234 | 8290352414D9F5B200ACF7E4 /* TBXML-iOS */ = {
235 | isa = PBXNativeTarget;
236 | buildConfigurationList = 8290354814D9F5B200ACF7E4 /* Build configuration list for PBXNativeTarget "TBXML-iOS" */;
237 | buildPhases = (
238 | 8290352114D9F5B200ACF7E4 /* Sources */,
239 | 8290352214D9F5B200ACF7E4 /* Frameworks */,
240 | 8290352314D9F5B200ACF7E4 /* Headers */,
241 | );
242 | buildRules = (
243 | );
244 | dependencies = (
245 | );
246 | name = "TBXML-iOS";
247 | productName = "TBXML-iOS";
248 | productReference = 8290352514D9F5B200ACF7E4 /* libTBXML-iOS.a */;
249 | productType = "com.apple.product-type.library.static";
250 | };
251 | 8290353214D9F5B200ACF7E4 /* TBXML-iOSTests */ = {
252 | isa = PBXNativeTarget;
253 | buildConfigurationList = 8290354914D9F5B200ACF7E4 /* Build configuration list for PBXNativeTarget "TBXML-iOSTests" */;
254 | buildPhases = (
255 | 8290352E14D9F5B200ACF7E4 /* Sources */,
256 | 8290352F14D9F5B200ACF7E4 /* Frameworks */,
257 | 8290353014D9F5B200ACF7E4 /* Resources */,
258 | 8290353114D9F5B200ACF7E4 /* ShellScript */,
259 | );
260 | buildRules = (
261 | );
262 | dependencies = (
263 | 8290353914D9F5B200ACF7E4 /* PBXTargetDependency */,
264 | );
265 | name = "TBXML-iOSTests";
266 | productName = "TBXML-iOSTests";
267 | productReference = 8290353314D9F5B200ACF7E4 /* TBXML-iOSTests.octest */;
268 | productType = "com.apple.product-type.bundle";
269 | };
270 | 829FA09B14D5B52A00D18697 /* TBXML */ = {
271 | isa = PBXNativeTarget;
272 | buildConfigurationList = 829FA0C214D5B52A00D18697 /* Build configuration list for PBXNativeTarget "TBXML" */;
273 | buildPhases = (
274 | 829FA09814D5B52A00D18697 /* Sources */,
275 | 829FA09914D5B52A00D18697 /* Frameworks */,
276 | 829FA09A14D5B52A00D18697 /* Headers */,
277 | );
278 | buildRules = (
279 | );
280 | dependencies = (
281 | );
282 | name = TBXML;
283 | productName = TBXML;
284 | productReference = 829FA09C14D5B52A00D18697 /* libTBXML.a */;
285 | productType = "com.apple.product-type.library.static";
286 | };
287 | 829FA0AF14D5B52A00D18697 /* TBXMLTests */ = {
288 | isa = PBXNativeTarget;
289 | buildConfigurationList = 829FA0C514D5B52A00D18697 /* Build configuration list for PBXNativeTarget "TBXMLTests" */;
290 | buildPhases = (
291 | 829FA0AB14D5B52A00D18697 /* Sources */,
292 | 829FA0AC14D5B52A00D18697 /* Frameworks */,
293 | 829FA0AD14D5B52A00D18697 /* Resources */,
294 | 829FA0AE14D5B52A00D18697 /* ShellScript */,
295 | );
296 | buildRules = (
297 | );
298 | dependencies = (
299 | 829FA0B514D5B52A00D18697 /* PBXTargetDependency */,
300 | );
301 | name = TBXMLTests;
302 | productName = TBXMLTests;
303 | productReference = 829FA0B014D5B52A00D18697 /* TBXMLTests.octest */;
304 | productType = "com.apple.product-type.bundle";
305 | };
306 | /* End PBXNativeTarget section */
307 |
308 | /* Begin PBXProject section */
309 | 829FA09314D5B52A00D18697 /* Project object */ = {
310 | isa = PBXProject;
311 | attributes = {
312 | LastUpgradeCheck = 0420;
313 | ORGANIZATIONNAME = "71 Squared";
314 | };
315 | buildConfigurationList = 829FA09614D5B52A00D18697 /* Build configuration list for PBXProject "TBXML" */;
316 | compatibilityVersion = "Xcode 3.2";
317 | developmentRegion = English;
318 | hasScannedForEncodings = 0;
319 | knownRegions = (
320 | en,
321 | );
322 | mainGroup = 829FA09114D5B52A00D18697;
323 | productRefGroup = 829FA09D14D5B52A00D18697 /* Products */;
324 | projectDirPath = "";
325 | projectRoot = "";
326 | targets = (
327 | 829FA09B14D5B52A00D18697 /* TBXML */,
328 | 829FA0AF14D5B52A00D18697 /* TBXMLTests */,
329 | 8290352414D9F5B200ACF7E4 /* TBXML-iOS */,
330 | 8290353214D9F5B200ACF7E4 /* TBXML-iOSTests */,
331 | );
332 | };
333 | /* End PBXProject section */
334 |
335 | /* Begin PBXResourcesBuildPhase section */
336 | 8290353014D9F5B200ACF7E4 /* Resources */ = {
337 | isa = PBXResourcesBuildPhase;
338 | buildActionMask = 2147483647;
339 | files = (
340 | 8290356314D9F8F600ACF7E4 /* books.xml in Resources */,
341 | 8290356214D9F8F300ACF7E4 /* InfoPlist.strings in Resources */,
342 | );
343 | runOnlyForDeploymentPostprocessing = 0;
344 | };
345 | 829FA0AD14D5B52A00D18697 /* Resources */ = {
346 | isa = PBXResourcesBuildPhase;
347 | buildActionMask = 2147483647;
348 | files = (
349 | 8290355E14D9F8DA00ACF7E4 /* books.xml in Resources */,
350 | 8290355F14D9F8DD00ACF7E4 /* InfoPlist.strings in Resources */,
351 | );
352 | runOnlyForDeploymentPostprocessing = 0;
353 | };
354 | /* End PBXResourcesBuildPhase section */
355 |
356 | /* Begin PBXShellScriptBuildPhase section */
357 | 8290353114D9F5B200ACF7E4 /* ShellScript */ = {
358 | isa = PBXShellScriptBuildPhase;
359 | buildActionMask = 2147483647;
360 | files = (
361 | );
362 | inputPaths = (
363 | );
364 | outputPaths = (
365 | );
366 | runOnlyForDeploymentPostprocessing = 0;
367 | shellPath = /bin/sh;
368 | shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
369 | };
370 | 829FA0AE14D5B52A00D18697 /* ShellScript */ = {
371 | isa = PBXShellScriptBuildPhase;
372 | buildActionMask = 2147483647;
373 | files = (
374 | );
375 | inputPaths = (
376 | );
377 | outputPaths = (
378 | );
379 | runOnlyForDeploymentPostprocessing = 0;
380 | shellPath = /bin/sh;
381 | shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
382 | };
383 | /* End PBXShellScriptBuildPhase section */
384 |
385 | /* Begin PBXSourcesBuildPhase section */
386 | 8290352114D9F5B200ACF7E4 /* Sources */ = {
387 | isa = PBXSourcesBuildPhase;
388 | buildActionMask = 2147483647;
389 | files = (
390 | 8290354B14D9F6B100ACF7E4 /* TBXML+Compression.m in Sources */,
391 | 8290354C14D9F6B100ACF7E4 /* TBXML+HTTP.m in Sources */,
392 | 8290354D14D9F6B100ACF7E4 /* TBXML.m in Sources */,
393 | );
394 | runOnlyForDeploymentPostprocessing = 0;
395 | };
396 | 8290352E14D9F5B200ACF7E4 /* Sources */ = {
397 | isa = PBXSourcesBuildPhase;
398 | buildActionMask = 2147483647;
399 | files = (
400 | 8290356114D9F8F100ACF7E4 /* TBXMLTests.m in Sources */,
401 | );
402 | runOnlyForDeploymentPostprocessing = 0;
403 | };
404 | 829FA09814D5B52A00D18697 /* Sources */ = {
405 | isa = PBXSourcesBuildPhase;
406 | buildActionMask = 2147483647;
407 | files = (
408 | 829FA0D014D5B55D00D18697 /* TBXML+Compression.m in Sources */,
409 | 829FA0D114D5B55D00D18697 /* TBXML+HTTP.m in Sources */,
410 | 829FA0D214D5B55D00D18697 /* TBXML.m in Sources */,
411 | );
412 | runOnlyForDeploymentPostprocessing = 0;
413 | };
414 | 829FA0AB14D5B52A00D18697 /* Sources */ = {
415 | isa = PBXSourcesBuildPhase;
416 | buildActionMask = 2147483647;
417 | files = (
418 | 8290356014D9F8E300ACF7E4 /* TBXMLTests.m in Sources */,
419 | );
420 | runOnlyForDeploymentPostprocessing = 0;
421 | };
422 | /* End PBXSourcesBuildPhase section */
423 |
424 | /* Begin PBXTargetDependency section */
425 | 8290353914D9F5B200ACF7E4 /* PBXTargetDependency */ = {
426 | isa = PBXTargetDependency;
427 | target = 8290352414D9F5B200ACF7E4 /* TBXML-iOS */;
428 | targetProxy = 8290353814D9F5B200ACF7E4 /* PBXContainerItemProxy */;
429 | };
430 | 829FA0B514D5B52A00D18697 /* PBXTargetDependency */ = {
431 | isa = PBXTargetDependency;
432 | target = 829FA09B14D5B52A00D18697 /* TBXML */;
433 | targetProxy = 829FA0B414D5B52A00D18697 /* PBXContainerItemProxy */;
434 | };
435 | /* End PBXTargetDependency section */
436 |
437 | /* Begin XCBuildConfiguration section */
438 | 8290354414D9F5B200ACF7E4 /* Debug */ = {
439 | isa = XCBuildConfiguration;
440 | buildSettings = {
441 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
442 | DSTROOT = /tmp/TBXML_iOS.dst;
443 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
444 | GCC_PREFIX_HEADER = "TBXML-Support/TBXML-iOS-Prefix.pch";
445 | IPHONEOS_DEPLOYMENT_TARGET = 5.0;
446 | OTHER_LDFLAGS = "-ObjC";
447 | PRODUCT_NAME = "$(TARGET_NAME)";
448 | SDKROOT = iphoneos;
449 | SKIP_INSTALL = YES;
450 | };
451 | name = Debug;
452 | };
453 | 8290354514D9F5B200ACF7E4 /* Release */ = {
454 | isa = XCBuildConfiguration;
455 | buildSettings = {
456 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
457 | DSTROOT = /tmp/TBXML_iOS.dst;
458 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
459 | GCC_PREFIX_HEADER = "TBXML-Support/TBXML-iOS-Prefix.pch";
460 | IPHONEOS_DEPLOYMENT_TARGET = 5.0;
461 | OTHER_LDFLAGS = "-ObjC";
462 | PRODUCT_NAME = "$(TARGET_NAME)";
463 | SDKROOT = iphoneos;
464 | SKIP_INSTALL = YES;
465 | VALIDATE_PRODUCT = YES;
466 | };
467 | name = Release;
468 | };
469 | 8290354614D9F5B200ACF7E4 /* Debug */ = {
470 | isa = XCBuildConfiguration;
471 | buildSettings = {
472 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
473 | FRAMEWORK_SEARCH_PATHS = (
474 | "$(SDKROOT)/Developer/Library/Frameworks",
475 | "$(DEVELOPER_LIBRARY_DIR)/Frameworks",
476 | );
477 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
478 | GCC_PREFIX_HEADER = "TBXML-Support/TBXML-iOS-Prefix.pch";
479 | INFOPLIST_FILE = "TBXML-Tests/Supporting Files/TBXMLTests-Info.plist";
480 | IPHONEOS_DEPLOYMENT_TARGET = 5.0;
481 | PRODUCT_NAME = "$(TARGET_NAME)";
482 | SDKROOT = iphoneos;
483 | WRAPPER_EXTENSION = octest;
484 | };
485 | name = Debug;
486 | };
487 | 8290354714D9F5B200ACF7E4 /* Release */ = {
488 | isa = XCBuildConfiguration;
489 | buildSettings = {
490 | ARCHS = "$(ARCHS_STANDARD_32_BIT)";
491 | FRAMEWORK_SEARCH_PATHS = (
492 | "$(SDKROOT)/Developer/Library/Frameworks",
493 | "$(DEVELOPER_LIBRARY_DIR)/Frameworks",
494 | );
495 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
496 | GCC_PREFIX_HEADER = "TBXML-Support/TBXML-iOS-Prefix.pch";
497 | INFOPLIST_FILE = "TBXML-Tests/Supporting Files/TBXMLTests-Info.plist";
498 | IPHONEOS_DEPLOYMENT_TARGET = 5.0;
499 | PRODUCT_NAME = "$(TARGET_NAME)";
500 | SDKROOT = iphoneos;
501 | VALIDATE_PRODUCT = YES;
502 | WRAPPER_EXTENSION = octest;
503 | };
504 | name = Release;
505 | };
506 | 829FA0C014D5B52A00D18697 /* Debug */ = {
507 | isa = XCBuildConfiguration;
508 | buildSettings = {
509 | ALWAYS_SEARCH_USER_PATHS = NO;
510 | ARCHS = "$(ARCHS_STANDARD_64_BIT)";
511 | CLANG_ENABLE_OBJC_ARC = YES;
512 | COPY_PHASE_STRIP = NO;
513 | GCC_C_LANGUAGE_STANDARD = gnu99;
514 | GCC_DYNAMIC_NO_PIC = NO;
515 | GCC_ENABLE_OBJC_EXCEPTIONS = YES;
516 | GCC_OPTIMIZATION_LEVEL = 0;
517 | GCC_PREPROCESSOR_DEFINITIONS = (
518 | "DEBUG=1",
519 | "$(inherited)",
520 | );
521 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
522 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
523 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
524 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
525 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
526 | GCC_WARN_UNUSED_VARIABLE = YES;
527 | MACOSX_DEPLOYMENT_TARGET = 10.7;
528 | ONLY_ACTIVE_ARCH = YES;
529 | SDKROOT = macosx;
530 | };
531 | name = Debug;
532 | };
533 | 829FA0C114D5B52A00D18697 /* Release */ = {
534 | isa = XCBuildConfiguration;
535 | buildSettings = {
536 | ALWAYS_SEARCH_USER_PATHS = NO;
537 | ARCHS = "$(ARCHS_STANDARD_64_BIT)";
538 | CLANG_ENABLE_OBJC_ARC = YES;
539 | COPY_PHASE_STRIP = YES;
540 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
541 | GCC_C_LANGUAGE_STANDARD = gnu99;
542 | GCC_ENABLE_OBJC_EXCEPTIONS = YES;
543 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
544 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
545 | GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
546 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
547 | GCC_WARN_UNUSED_VARIABLE = YES;
548 | MACOSX_DEPLOYMENT_TARGET = 10.7;
549 | SDKROOT = macosx;
550 | };
551 | name = Release;
552 | };
553 | 829FA0C314D5B52A00D18697 /* Debug */ = {
554 | isa = XCBuildConfiguration;
555 | buildSettings = {
556 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
557 | GCC_PREFIX_HEADER = "TBXML-Support/TBXML-Prefix.pch";
558 | PRODUCT_NAME = "$(TARGET_NAME)";
559 | };
560 | name = Debug;
561 | };
562 | 829FA0C414D5B52A00D18697 /* Release */ = {
563 | isa = XCBuildConfiguration;
564 | buildSettings = {
565 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
566 | GCC_PREFIX_HEADER = "TBXML-Support/TBXML-Prefix.pch";
567 | PRODUCT_NAME = "$(TARGET_NAME)";
568 | };
569 | name = Release;
570 | };
571 | 829FA0C614D5B52A00D18697 /* Debug */ = {
572 | isa = XCBuildConfiguration;
573 | buildSettings = {
574 | FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
575 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
576 | GCC_PREFIX_HEADER = "TBXML-Support/TBXML-Prefix.pch";
577 | INFOPLIST_FILE = "TBXML-Tests/Supporting Files/TBXMLTests-Info.plist";
578 | PRODUCT_NAME = "$(TARGET_NAME)";
579 | WRAPPER_EXTENSION = octest;
580 | };
581 | name = Debug;
582 | };
583 | 829FA0C714D5B52A00D18697 /* Release */ = {
584 | isa = XCBuildConfiguration;
585 | buildSettings = {
586 | FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks";
587 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
588 | GCC_PREFIX_HEADER = "TBXML-Support/TBXML-Prefix.pch";
589 | INFOPLIST_FILE = "TBXML-Tests/Supporting Files/TBXMLTests-Info.plist";
590 | PRODUCT_NAME = "$(TARGET_NAME)";
591 | WRAPPER_EXTENSION = octest;
592 | };
593 | name = Release;
594 | };
595 | /* End XCBuildConfiguration section */
596 |
597 | /* Begin XCConfigurationList section */
598 | 8290354814D9F5B200ACF7E4 /* Build configuration list for PBXNativeTarget "TBXML-iOS" */ = {
599 | isa = XCConfigurationList;
600 | buildConfigurations = (
601 | 8290354414D9F5B200ACF7E4 /* Debug */,
602 | 8290354514D9F5B200ACF7E4 /* Release */,
603 | );
604 | defaultConfigurationIsVisible = 0;
605 | defaultConfigurationName = Release;
606 | };
607 | 8290354914D9F5B200ACF7E4 /* Build configuration list for PBXNativeTarget "TBXML-iOSTests" */ = {
608 | isa = XCConfigurationList;
609 | buildConfigurations = (
610 | 8290354614D9F5B200ACF7E4 /* Debug */,
611 | 8290354714D9F5B200ACF7E4 /* Release */,
612 | );
613 | defaultConfigurationIsVisible = 0;
614 | defaultConfigurationName = Release;
615 | };
616 | 829FA09614D5B52A00D18697 /* Build configuration list for PBXProject "TBXML" */ = {
617 | isa = XCConfigurationList;
618 | buildConfigurations = (
619 | 829FA0C014D5B52A00D18697 /* Debug */,
620 | 829FA0C114D5B52A00D18697 /* Release */,
621 | );
622 | defaultConfigurationIsVisible = 0;
623 | defaultConfigurationName = Release;
624 | };
625 | 829FA0C214D5B52A00D18697 /* Build configuration list for PBXNativeTarget "TBXML" */ = {
626 | isa = XCConfigurationList;
627 | buildConfigurations = (
628 | 829FA0C314D5B52A00D18697 /* Debug */,
629 | 829FA0C414D5B52A00D18697 /* Release */,
630 | );
631 | defaultConfigurationIsVisible = 0;
632 | defaultConfigurationName = Release;
633 | };
634 | 829FA0C514D5B52A00D18697 /* Build configuration list for PBXNativeTarget "TBXMLTests" */ = {
635 | isa = XCConfigurationList;
636 | buildConfigurations = (
637 | 829FA0C614D5B52A00D18697 /* Debug */,
638 | 829FA0C714D5B52A00D18697 /* Release */,
639 | );
640 | defaultConfigurationIsVisible = 0;
641 | defaultConfigurationName = Release;
642 | };
643 | /* End XCConfigurationList section */
644 | };
645 | rootObject = 829FA09314D5B52A00D18697 /* Project object */;
646 | }
647 |
--------------------------------------------------------------------------------