0
<category 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.

VansFannel
  • 45,055
  • 107
  • 359
  • 626
nipin 555
  • 203
  • 1
  • 3
  • 9

1 Answers1

4

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");
    }
}
dasdom
  • 13,975
  • 2
  • 47
  • 58