I've searched the internet and am still having problems implementing XML into my project. At the moment I can set up an array using NSMutableArray and that works find. However all the data is stored in the AppDelegate.m.
Heres how I add entries into the array.
Code:
ebooks_list = [NSMutableArray arrayWithCapacity:20];
//First entry
//Set var first
ebooks *ebook;
//Entry
ebook = [[ebooks alloc] init];
ebook.isbn =@"0000000000000";
ebook.title =@"Book Title";
ebook.author =@"Author";
ebook.disc =@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam at sagittis mi. Donec consequat, nulla a rutrum posuere, ante ligula egestas erat, non bibendum magna risus non mauris. Sed scelerisque ligula metus, vel sodales nulla. Fusce elementum dolor in mi aliquam laoreet. Morbi a justo ullamcorper nisi eleifend pulvinar ac vitae tortor. Cras sit amet eros urna. Pellentesque eget turpis vitae ante facilisis consectetur. Curabitur eget condimentum arcu. Aenean quis sapien risus, nec vehicula neque. Cras viverra dui non mi imperdiet at commodo orci hendrerit.";
ebook.ibookstorelink =@"http://itunes.apple.com/au/book/id445995313?mt=11";
ebook.eBookCorpLink =@"";
ebook.AmazonLink =@"";
//Entry
[ebooks_list addObject:ebook];
ebook = [[ebooks alloc] init];
ebook.isbn =@"0000000000000";
ebook.title =@"Book Title";
ebook.author =@"Author";
ebook.disc =@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam at sagittis mi. Donec consequat, nulla a rutrum posuere, ante ligula egestas erat, non bibendum magna risus non mauris. Sed scelerisque ligula metus, vel sodales nulla. Fusce elementum dolor in mi aliquam laoreet. Morbi a justo ullamcorper nisi eleifend pulvinar ac vitae tortor. Cras sit amet eros urna. Pellentesque eget turpis vitae ante facilisis consectetur. Curabitur eget condimentum arcu. Aenean quis sapien risus, nec vehicula neque. Cras viverra dui non mi imperdiet at commodo orci hendrerit.";
ebook.ibookstorelink =@"http://itunes.apple.com/au/book/id445995313?mt=11";
ebook.eBookCorpLink =@"";
ebook.AmazonLink =@"";
[ebooks_list addObject:ebook];
I know this may be an easy question but I am stumped.
I've searched the internet and am still having problems implementing XML into my project. At the moment I can set up an array using NSMutableArray and that works find. However all the data is stored in the AppDelegate.m.
Heres how I add entries into the array.
Code:
ebooks_list = [NSMutableArray arrayWithCapacity:20];
//First entry
//Set var first
ebooks *ebook;
//Entry
ebook = [[ebooks alloc] init];
ebook.isbn =@"0000000000000";
ebook.title =@"Book Title";
ebook.author =@"Author";
ebook.disc =@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam at sagittis mi. Donec consequat, nulla a rutrum posuere, ante ligula egestas erat, non bibendum magna risus non mauris. Sed scelerisque ligula metus, vel sodales nulla. Fusce elementum dolor in mi aliquam laoreet. Morbi a justo ullamcorper nisi eleifend pulvinar ac vitae tortor. Cras sit amet eros urna. Pellentesque eget turpis vitae ante facilisis consectetur. Curabitur eget condimentum arcu. Aenean quis sapien risus, nec vehicula neque. Cras viverra dui non mi imperdiet at commodo orci hendrerit.";
ebook.ibookstorelink =@"http://itunes.apple.com/au/book/id445995313?mt=11";
ebook.eBookCorpLink =@"";
ebook.AmazonLink =@"";
//Entry
[ebooks_list addObject:ebook];
ebook = [[ebooks alloc] init];
ebook.isbn =@"0000000000000";
ebook.title =@"Book Title";
ebook.author =@"Author";
ebook.disc =@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam at sagittis mi. Donec consequat, nulla a rutrum posuere, ante ligula egestas erat, non bibendum magna risus non mauris. Sed scelerisque ligula metus, vel sodales nulla. Fusce elementum dolor in mi aliquam laoreet. Morbi a justo ullamcorper nisi eleifend pulvinar ac vitae tortor. Cras sit amet eros urna. Pellentesque eget turpis vitae ante facilisis consectetur. Curabitur eget condimentum arcu. Aenean quis sapien risus, nec vehicula neque. Cras viverra dui non mi imperdiet at commodo orci hendrerit.";
ebook.ibookstorelink =@"http://itunes.apple.com/au/book/id445995313?mt=11";
ebook.eBookCorpLink =@"";
ebook.AmazonLink =@"";
[ebooks_list addObject:ebook];
I know this may be an easy question but I am stumped.
Any help would me muchly appreciated
You're creating eBook objects, and adding them to a mutable array. However, you did not say anything about XML other than mentioning that you are "implementing XML into my project."
What, exactly, is your question, and how does it relate to XML?
By the way, unless you're using ARC, you are leaking the ebook objects you create. You need to release each ebook object after you add it to the array.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
You're creating eBook objects, and adding them to a mutable array. However, you did not say anything about XML other than mentioning that you are "implementing XML into my project."
What, exactly, is your question, and how does it relate to XML?
By the way, unless you're using ARC, you are leaking the ebook objects you create. You need to release each ebook object after you add it to the array.
Thank you for your message.
What i want to do is have a XML file in the iPhone's documents file that can be updated via a download from our site.
I guess the crutch of my question is how do i read an xml file and get it to populate into the array.
Thank you for the tip about leaking - i will look into that.