4

当我在我的应用程序中使用 GData API 来解析 xml 时,我如何获取属性及其值?想要一段示例代码。非常感谢。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>
4

2 回答 2

4
 NSInteger type=[[(GDataXMLNode *)[[urls objectAtIndex:i] attributeForName:@"type"] stringValue] intValue];
 NSInteger bit_stream=[[(GDataXMLNode *)[[urls objectAtIndex:i]attributeForName:@"bit_stream"] stringValue] intValue];
于 2010-06-22T00:34:23.560 回答
0

Google 提供了很多示例代码来展示如何使用他们的 API。根据您使用的协议,您应该能够从API Directory获取示例。

于 2010-06-12T09:26:01.890 回答