开发者

IPAD xml parsing with attributes deal

开发者 https://www.devze.com 2023-03-21 18:38 出处:网络
<category 开发者_JAVA百科name=\"Local\"> … … … <category name=\"business\"> … …
<category 开发者_JAVA百科name="Local"> 
…
…
…
<category name="business"> 
…
…
…
<category name="politics"> 
…
…
…

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.


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

Edit:

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");
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消