4

When i use GData API in my app for parsing xml,how could i get attributes and it's value? Wanted a piece of example code.Thanks a lot. xml:

   <playurls><url islive="0" type="3" bit_stream="1">http://vods.netitv.com//dy2/2010/02/08/cf584b76-3579-4b75-a0c8-f7a473d79f8c.mp4
    </url><url islive="0" type="3" bit_stream="2">http://vods.netitv.com//dy/2010/02/08/965bbc65-8ec0-4c50-98ae-c69a831926cc.mp4
    </url><url islive="0" type="2" bit_stream="1">http://vods.netitv.com//dy2/2010/02/08/cf584b76-3579-4b75-a0c8-f7a473d79f8c.mp4
    </url><url islive="0" type="2" bit_stream="2">http://vods.netitv.com//dy/2010/02/08/965bbc65-8ec0-4c50-98ae-c69a831926cc.mp4
    </url></playurls>
ben
  • 1,020
  • 1
  • 15
  • 27

2 Answers2

4
 NSInteger type=[[(GDataXMLNode *)[[urls objectAtIndex:i] attributeForName:@"type"] stringValue] intValue];
 NSInteger bit_stream=[[(GDataXMLNode *)[[urls objectAtIndex:i]attributeForName:@"bit_stream"] stringValue] intValue];
ben
  • 1,020
  • 1
  • 15
  • 27
0

Google have provided quite a lot of sample code that shows how to use their API. Depending of which protocol you use, you should be able to get the samples from the API Directory.

Claus Broch
  • 9,212
  • 2
  • 29
  • 38
  • I guess these help some but am sure there are many like me that find examples like these bloated with so much content it proves near impossible for a less experienced coder to get to grips with. I dont see why those at google (other API suppliers too) dont offer more clear clean basic examples? Apple too are guilty of this. – user7865437 Sep 13 '11 at 07:31