last day (30 days later) » 

2:41 AM
hey
 
3:15 AM
hi
I don't quite understand what your 'sections' are. The XPath you posted will get you the menu items the specific day/time/counter. Do you use different XPaths to get the different sections or do you want to use a different XPath in this method to capture the data?
 
Currently I use multiple xpath to get each section
 
3:56 AM
is there another way?
 
4:43 AM
It is simply a matter of setting your XPath at the level where you want your sections and then iterating within those sections to build the content for the sections
For example if you used //day[@name='monday']/meal[@name='LUNCH'] your for loop would give you all of the counters - you could then create an NSArray for each of the dishes inside the counter and put this array into a dictionary using the counter name as the key - It just depends on what you want to display in your app
 
 
8 hours later…
12:57 PM
okay that makes sense, I want to display the items in the < name > some item </name >
 
1:08 PM
but you talk about sections, so I presume that you want to display the <items> split by counter or meal or whatever
 
 
2 hours later…
2:44 PM
by counter that is correct
and meal
 
 
5 hours later…
7:44 PM
If you want counter and meal then you will probably need to use something like a UINavigationController - the first tableview can show you the meal and when one is selected you could push a new tableview with sections for the counters and entries for the items. Or you could use a single tableview with sections for meals and then different cell types for counters and items.
The first thing is to create a data model object and parse the XML into it. Then you can display it however you want. I would probably use an array for the severn days. Each element of this array would be an array of 3 meal times (or however many there are). Each of the meal time arrays would contain a dictionary whose key was the counter and the value is an array of items.
 
currently I have a i tableView that lets the user select which meal they want and then it pushed a new tableView that shows the counters as section and the items in the rows of the section
but I have been doing all the set up for the section headers and such manually which I can't do anymore
 
Ok. As I said, you can create a data model object with the arrays/dictionaries. Your parse code would be something like
NSArray *Nodes = [Parser searchWithXPathQuery:@"//day"];
A for loop to loop through each of the day nodes. If you can't rely on the days being in order then you should check the attributes property to work out which day you have. Then get the array from childrenWithTagName for the tag name "meal" - loop through this array retrieving the name attribute, retrieve the "counter" children and so on. I haven't got time to write this in code right now, but I can put something together for you later
 
8:04 PM
ya i think I see what your saying whenever you get a chance, Im going to post a bounty on this question tomorrow when the wait time is up thanks for your help so far
 
 
2 hours later…
10:30 PM
just wondering when do u think you will be able to have some code?
 
 
1 hour later…
11:33 PM
I am working on some now
 
11:49 PM
okay great thanks
 

  last day (30 days later) »