请求使用GData API解析xml和获取属性的示例代码 [英] Ask for an example code for parsing xml and get attributes by using GData API

查看:129
本文介绍了请求使用GData API解析xml和获取属性的示例代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在我的应用程序中使用GData API解析xml时,我怎样才能获得属性及其值?
想要一段示例代码。非常感谢。
xml:

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>


推荐答案

 NSInteger type=[[(GDataXMLNode *)[[urls objectAtIndex:i] attributeForName:@"type"] stringValue] intValue];
 NSInteger bit_stream=[[(GDataXMLNode *)[[urls objectAtIndex:i]attributeForName:@"bit_stream"] stringValue] intValue];

这篇关于请求使用GData API解析xml和获取属性的示例代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆