在我的 iPhone 应用程序中,我有以下 NSString:
NSString *myxml=@"<students>
<student><name>Raju</name><age>25</age><address>abcd</address>
</student></students>";
我将如何解析该字符串的 XML 内容?
下载:https://github.com/bcaccinolo/XML-to-NSDictionary https://github.com/bcaccinolo/XML-to-NSDictionary
然后你只需要做:
NSDictionary *dic = [XMLReader dictionaryForXMLString:myxml error:nil];
结果是一个 NSDictionary *dic,里面有字典、数组和字符串,具体取决于 XML:
{
students = {
student = {
address = abcd;
age = 25;
name = Raju;
};
};
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)