hi all ,
I am following an xml parsing example from this link http://www.iphonesdkarticles.com/2008/11/parsing-xml-files.html - iPhone SDK Articles to parse my own xml file which is in this format....
but i dont know how to write this part of code for my example...
Quote:
please help
I am following an xml parsing example from this link http://www.iphonesdkarticles.com/2008/11/parsing-xml-files.html - iPhone SDK Articles to parse my own xml file which is in this format....
Code:
Quote:
<?xml version="1.0" encoding="UTF-8" ?>
- <Root>
- <CourseBeansList>
- <CourseBean>
<LearningId>COURSE_1</LearningId>
<LearningType>Online</LearningType>
<Title>AAO - Anatomy of the Ear</Title>
<Description>Sample AAO course used for LMS Shootout at Online Learning Conference, 2002 in Anaheim, CA</Description>
<CatalogList>Default Public CatalogOtolaryngology</CatalogList>
</CourseBean>
but i dont know how to write this part of code for my example...
Quote:
Code:
-(void)parser: (NSXMLParser *)parser didStartElementNSString *)elementName
namespaceURINSString *)namespaceURI qualifiedName: (NSString *)qualifiedName
attributes: (NSDictionary *)attributeDict {
if([elementName isEqualToString:@"Courselist"]) {
//initialize the array.
appDelegate.CourseBeansList = [[NSMutableArray alloc] init];
}
else if([elementName isEqualToString:@"Courselist"]) {
//initialize the book
aCourselist = [[Courselist alloc] init];
//extract the attribute here.
aCourselist.CourseBean = [[attributeDict objectForKey:@"id"] integerValue];
NSLog(@"Reading id value :%i", aCourselist.CourseBean);
}
NSLog(@"Processing Element: %@", elementName);
}