tags:

views:

60

answers:

2

hi .. I just work on web-based application for iPhone, And I try to retrieve data from my website to my app. can I edit XML code for my website as I want to be in my iPhone app? for example, XML for my website is:

<item>
<title>Announcement title</title>
<link>iphone feed</link>
<description>Announcement type</description>
<category>Students</category>
<pubDate>April 5, 2010, 12:50 pm</pubDate>
  <guid>iphone feed</guid>
</item>

but I can't retrieve all of this to the tableview in my app. So, I will edit the code to be like this:

<item>
 <category name="staff">
<Announcement title="welcome back">
<description>
      hope all of you enjoy in the vacation, and welcome back to university
</description>
</Announcement>
</category>
</item>

Is this the right way?

A: 

You should use the plist format, as it will be easier to load from Objective-C (using the dictionaryWithContentsOfFile method of the NSDictionary class).

See the documentation about property lists.

Macmade
A: 

If you use an XML parser, how you structure your XML document will be entirely up to you. Semantically, there seems to be no difference between the two snippets you're posting, but a parser should be able to translate either item node.

Alex Reynolds