IPAD xml 解析与属性交易 [英] IPAD xml parsing with attributes deal

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

问题描述

<category name="Local"> 
…
…
…
<category name="business"> 
…
…
…
<category name="politics"> 
…
…
…

这是我的 xml 文件,我不确定如何处理我正在使用 NSXMLParser 的属性.我的问题是如何处理 NSXMLParser 中的上述属性.请帮我.提前致谢.

This is my xml file, I'm not sure how to deal with attribute i am using NSXMLParser. My question is how to deal with above attributes in NSXMLParser. Please help me. Thanks in advance.

推荐答案

你应该看看 解析器:didStartElement:namespaceURI:qualifiedName:attributes:.然后名称就在属性字典中.

You should have a look at parser:didStartElement:namespaceURI:qualifiedName:attributes:. The names are then in the attributes dictionary.

如果以下内容对您没有帮助,您应该阅读一些介绍内容.

If the following doesn't help you, you should read some introduction stuff.

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict {
    if ([[attributeDict objectForKey: @"name"] isEqualToString: @"Local"]) {
        NSLog(@"found category with name Local");
    }
}

这篇关于IPAD xml 解析与属性交易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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