解析XML,细节和属性,iphone [英] Parsing XML, details and attributes, iphone

查看:66
本文介绍了解析XML,细节和属性,iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定是否使用属性解析xml。已经看到类似的问题这里
但它显示得到一个intValue的属性。但我需要获取字符串类型的属性,如何做到这一点? xml的图像和相关部分在以下链接中给出

I'm not sure about parsing an xml with attributes. have seen a similar question here But it shows to get an attribute of intValue. But i need to get the attributes of string type,How to do that?? Images of xml and the relevant portions are given in the following links

单击此处为xml 此处提供所需数据

推荐答案

回答链接问题也适用于你。 attributeDict的内容已经是NStrings。在链接的答案中,他们正在调用返回的NSString上的intValue方法以将该字符串解析为int。在您的情况下,您不需要这一点额外的步骤。如果你这样做:

This answer to the linked question should work for you as well. The contents of attributeDict are already NStrings. All that is going on extra in the linked answer that they are calling the intValue method on the returned NSString to parse that string into an int. In your case, you don't need this little bit of an extra step. If you just do this:

NSString * stringValue = [attributeDict objectForKey:@"attribute"];

您将拥有字符串中名为attribute的属性值。

you'll have the value of the attribute called "attribute" in a string.

这篇关于解析XML,细节和属性,iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆