how to parse xml for ios development

前端 未结 2 2074
执笔经年
执笔经年 2021-01-06 06:08

So I know how to parse some XML structures but I am currently trying to parse this specific xml structure thats a bit different to what I am used to.

normally I woul

相关标签:
2条回答
  • 2021-01-06 06:39

    In your didStartItem: method, the attributes dictionary will contain values for all the XML attributes.

    0 讨论(0)
  • 2021-01-06 06:41

    The xml data above provides the data as attributes on the xml element.

    This callback method gives you access to the attributes as a dictionary of key values (attributeDict).

    (void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName 
      namespaceURI:(NSString *)namespaceURI 
      qualifiedName:(NSString *)qualifiedName 
      attributes:(NSDictionary *)attributeDict
    

    NSLog the dictionary out in that method to see the values:

    NSLog(@"attributes: %@", attributeDict);
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题