开发者

How to loop through the values of an NSMutableArray

I have XML data parched in a NSMutableArray and i need to loop through the array to see all values stored in it. This may be a stupid question but this is all new to me.

The xml file looks like this

<list>
<item id="1">
<title>Title 1</title>
<开发者_StackOverflow社区title>Content 1</title>
</item>
<item id="2">
<title>Title 2</title>
<title>Content 2</title>
</item>
</list>

This is the array that all data is collected

NSMutableArray *articleList=[[ArticleService getArticleList] retain];

If i output NSLog(@"articleList: %@", articleList); on this is the result I get, so I guess there is some data inside of the array.

2011-06-14 21:51:04.690 NAF[954:207] articleList: (
"<Article: 0x8021170>",
"<Article: 0x80214a0>",
"<Article: 0x8020660>",
"<Article: 0x802ba30>",
"<Article: 0x802a520>",
"<Article: 0x80267a0>",
"<Article: 0x8025bd0>",
"<Article: 0x80141e0>",
"<Article: 0x8024390>",
"<Article: 0x8026bb0>",
"<Article: 0x8029630>",
"<Article: 0x8019390>",
"<Article: 0x8015b50>",
"<Article: 0x8014dd0>",
"<Article: 0x8012fb0>"
)

So to the question. How can I loop true the array and get the value of every 'title' of the XML file. Im a hell of a cut and paste programmer, so if someone can be so helpful providing me with some code, I will appriciate it a lot.


Assuming that each article has a property called title

for(Article* a in articleList)
{
    NSLog(@"Title = %@",a.title);
{
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜