iPhone TBXML Looping And Parsing Data

后端 未结 4 1577
春和景丽
春和景丽 2020-12-18 00:12

Basically I have an XML response that is returned and a string, and i need to loops through the xml and store all the information in an array. here is the xml



        
4条回答
  •  独厮守ぢ
    2020-12-18 00:50

    Use Apple's NSXMLParser; it made be old-school and all but it's really efficient.

    Setup your XMLParser accordingly (use the NSXMLParserDelegate protocol).

    Once your parser hits call the parser:didStartElement:namespaceURI:qualifiedName:attributes: delegate call back and the elementName is equal to Record (from what you seem to want).

    Alloc' init' an NSMutableDictionary. Then like above if elementName is equal to Destination then [myDictionary setObject: elementName forKey: @"Destination"] and et cætera.

    Hope that helped :).

    Little side note: prefer using Apple's "technology" instead of 3rd parties: it's more efficient and the possibilities are endless.

提交回复
热议问题