使用属性处理的IPAD xml解析 [英] IPAD xml parsing with attributes deal

查看:131
本文介绍了使用属性处理的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.

推荐答案

你应该看看 parser: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天全站免登陆