在我的 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
然后你只需要做:
NSDictionary *dic = [XMLReader dictionaryForXMLString:myxml error:nil];
结果是一个 NSDictionary *dic,里面有字典、数组和字符串,具体取决于 XML:
{
students = {
student = {
address = abcd;
age = 25;
name = Raju;
};
};
}
关于iphone - 如何在 Objective-C 中解析包含 XML 的 NSString?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/924389/