I have the following methods in my simple Custom Parser Class, when I execute CALLED: on my data I get ...
Found: OK
Found: 046 3433 5674 3422 4456 8990 1200 5284
My question is how would I go about adding to this so that I can specifically pick out the information for the data element (see below), is there anything I can add to the - (void)parser: method, how might I do that?
<data version="1.0">2046 3433 5674 3422 4456 8990 1200 5284</data>
Here are sections of my code:
// CLASS:
@interface CustomParser : NSObject <NSXMLParserDelegate> {
}
-(void)parseFile:(NSString *)pathToFile;
@end
@implementation CustomParser
-(void)parseFile:(NSString *)pathToFile {
NSLog(@"parseXMLFile ... \"%@\"", pathToFile);
NSURL *url = [NSURL fileURLWithPath:pathToFile];
NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[parser setDelegate:self];
[parser parse];
[parser release];
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
NSLog(@"Found: %@", string);
}
@end
.
//CALLED:
CustomParser *newParser = [[CustomParser alloc] init];
[newParser parseFile:fileOnDisk];
... more
[newParser release];
.
//DATA:
<!DOCTYPE tubinerotationdata>
<turbine version="1.0">
<status version="1.0" result="200">OK</status>
<data version="1.0">
2046 3433 5674 3422 4456 8990 1200 5284
</data>
</turbine>
gary