so I want to parse an xml and display (in a UITableView) the “subjects” in ascending order depending on “lessons”
XML:
<parfumeo_kkn>
<tt_timetable>
<id>1015</id>
<day>1</day>
<class_id>98</class_id>
<lesson>9</lesson>
<teacher>bt</teacher>
<room>V1.2</room>
<subject>M</subject>
<pr_id>54</pr_id>
</tt_timetable>
<tt_timetable>
<id>1014</id>
<day>1</day>
<class_id>98</class_id>
<lesson>8</lesson>
<teacher>bt</teacher>
<room>V1.2</room>
<subject>bg</subject>
<pr_id>54</pr_id>
</tt_timetable>
ect.
(In this little example there would be “bg” before “M”.) I allready set up my parser but it’s not working in the order I want it to.
thx for help
You should separate the logic of the parser and how you display the results in the table views. The parser just does its task of parsing the xml, the controller for the table view will do a little bit extra task by ordering the results from the parser by using NSSortDescriptor, an example follows:
Yes, previously I am assuming you’re using Core Data, in case you just have a normal array, then you can just simply call:
Now you can use myArray to populate to your table view controller.
Hope this helps!