I am trying to put the contents of an XML file into an NSMutableArray. I want to be able to get the following result:
NSLog(@"%@", [myarray objectAtIndex: 1]; will return cookie.
The xml file looks like this:
<row>
<Word>aardvark</Word>
</row>
<row>
<Word>cookie</Word>
</row>
This is the code I have so far:
-(void)checkdictionary {
NSString *xmlPath = [[NSBundle mainBundle] pathForResource:@"englishwords" ofType:@"xml"];
NSData *xmlData = [NSData dataWithContentsOfFile:xmlPath];
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:xmlData];
[xmlParser setDelegate:self];
[xmlParser parse];
}
- (void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI
qualifiedName:(NSString *)qualifiedName
attributes:(NSDictionary *)attributeDict{
if ([elementName isEqualToString:@"Word"]){
}
}