views:

101

answers:

2

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>
A: 

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
+1  A: 
 NSInteger type=[[(GDataXMLNode *)[[urls objectAtIndex:i] attributeForName:@"type"] stringValue] intValue];
 NSInteger bit_stream=[[(GDataXMLNode *)[[urls objectAtIndex:i]attributeForName:@"bit_stream"] stringValue] intValue];
ben
I got it,It must be like this
ben