Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 22, 2009, 10:12 AM   #1
vamsi.ac
macrumors newbie
 
Join Date: Sep 2009
XML Parsing help please

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....
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);

}
please help
vamsi.ac is offline   0 Reply With Quote
Old Sep 22, 2009, 10:22 AM   #2
dejo
Demi-God (Moderator)
 
dejo's Avatar
 
Join Date: Sep 2004
Location: Colorado
First of all the
Code:
else if([elementName isEqualToString:@"Courselist"])
will never execute because it's the same condition as the first if.

Second, 'Courselist' is not even an element name given that sample XML file. Did you mean 'CourseBeansList'?
__________________
My iOS Apps: a.k.a., DreamStream
I support the MacRumors Blood Drive!
dejo is online now   0 Reply With Quote
Old Sep 24, 2009, 05:56 AM   #3
vamsi.ac
Thread Starter
macrumors newbie
 
Join Date: Sep 2009
program terminating due to uncaught exception

any one could please resolve my problem in this project. you can download my project from the link http://uploading.com/files/1faafca6/XML.zip/

please help me.. all i need to do is parse the xml
vamsi.ac is offline   0 Reply With Quote
Old Sep 24, 2009, 10:42 AM   #4
dejo
Demi-God (Moderator)
 
dejo's Avatar
 
Join Date: Sep 2004
Location: Colorado
Quote:
Originally Posted by vamsi.ac View Post
please help me.. all i need to do is parse the xml
Did you address the issues I brought up in my first post?
__________________
My iOS Apps: a.k.a., DreamStream
I support the MacRumors Blood Drive!
dejo is online now   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Parsing XML file - Please help!! tssav iPhone/iPad Programming 4 Dec 8, 2010 04:22 PM
how to get data, HTML tags in XML file, while xml parsing psudheer28 iPhone/iPad Programming 5 Aug 26, 2010 12:50 PM
How to edit XML parsed data and save on iPhone app Amit Jain iPhone/iPad Programming 1 Jan 13, 2009 01:46 AM
Regarding XML parsing MalathiV iPhone/iPad Programming 4 Dec 4, 2008 09:39 PM
pls help me in xml parsing vavdiyaharesh iPhone/iPad Programming 0 Nov 16, 2008 04:48 AM


All times are GMT -5. The time now is 10:36 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC