Hi,
I have a question about parsing the following structure. As you can see, categories is a repeating nested element. But I can't figure out how to parse this with NSXML Parser.
Can someone help me figure out how to convert this xml into a drill-down table view that lists categories? So in other words:
TableView Level 1
cardiology
TableView Level 2
primary_hypertension
secondary_hypertension
TableView Level 3 (revealed if secondary_hypertension is selected)
congestive_heart_failure
no_congestive_heart_failure
Code:
<?xml version="1.0" encoding="UTF-8"?>
<root>cardiology
<category>hypertension
<child>
<category>primary_hypertension
</category>
</child>
<child>
<category>secondary_hypertension
<child>
<category>congestive_heart_failure</category>
</child>
<child>
<category>no_congestive_heart_failure</category>
</child>
</category>
</child>
</category>
</root>
The issue seems to be the repeating nested categories. Sometimes one category has numerous subcategories. Other times a given category might have no subcategories. Is my xml constructed wrong? Thanks!
My problem is exactly the same as a guy who wanted to parse the following xml into menus and submenus. The multiple delegates sample is hard for me to follow as it is a snippet and not a full fleshed out example. Pointers and samples would be appreciate:
Code:
1. <testxml>
2. <Menu>
3. <MenuItem>
4. <menuName>Menu 1</menuName>
5. <MenuChildren>
6. <MenuItem>
7. <menuName>Sub-Menu 1</menuName>
8. </MenuItem>
9. <MenuItem>
10. <menuName>Sub-Menu 1a</menuName>
11. <MenuChildren>
12. <MenuItem>
13. <menuName>Sub-Sub-Menu 1aa</menuName>
14. </MenuItem>
15. </MenuChildren>
16. </MenuItem>
17. </MenuChildren>
18. </MenuItem>
19. <MenuItem>
20. <menuName>Menu 2</menuName>
21. </MenuItem>
22. <MenuItem>
23. <menuName>Menu 3</menuName>
24. </MenuItem>
25. <MenuItem>
26. <menuName>Menu 4</menuName>
27. </MenuItem>
28. </Menu>
29. </testxml>