当我在我的应用程序中使用 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>
最佳答案
NSInteger type=[[(GDataXMLNode *)[[urls objectAtIndex:i] attributeForName:@"type"] stringValue] intValue];
NSInteger bit_stream=[[(GDataXMLNode *)[[urls objectAtIndex:i]attributeForName:@"bit_stream"] stringValue] intValue];
关于iphone - 求一个使用GData API解析xml和获取属性的示例代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3028020/