views:

64

answers:

2

I’m trying to parse an XML file having ‘n’ number of questions using Objective C. I have to display those questions in labels at runtime in a view. That means ‘n’ labels for ‘n’ questions and ‘n’ labels for ‘n’ answers too. Does anyone have any suggestions about how to do this?

A: 

If you are using one of the .NET languages to achieve this you might want to look into using a FlowLayoutPanel or a TableLayoutPanel and dynamically create your labels and add them to the panel.

heavyd
They are not using .NET, but Objective-C.
Lyndsey Ferguson
+1  A: 

You probably will need to use the NSXMLDocument class to parse the XML file. Take a look at the documentation either at developer.apple.com or within Xcode by selecting "Documentation" under the Help menu.

Search for NSXMLDocument. Read the reference or click the link to read Tree-Based XML Programming Guide for Cocoa.

You can also find some sample code at: http://www.mactech.com/articles/mactech/Vol.21/21.06/XMLParser/

Good luck.

Lyndsey Ferguson