【Cocos2d-x游戏引擎开发笔记(25)】XML解析

        分类:            Cocos2d-x游戏引擎开发2013-06-19 15:321970人阅读评论(3)收藏举报
Cocos2d-xXML解析

原创文章,转载请注明出处:http://blog.csdn.net/zhy_cheng/article/details/9128819

XML是一种非常重要的文件格式,由于C++对XML的支持非常完善,cocos2d-x选择XML作为主要的文件存储格式。在cocos2d-x中集成了libxml2来解析XML数据。

定义一个用于解析的类,这个类继承CCSAXDelegator和CCObject,然后实现CCSAXDelegator的纯虚函数。

[cpp] view plaincopyprint?
  1. #ifndef XMLANALYSIS_H_H
  2. #define XMLANALYSIS_H_H
  3. #include "cocos2d.h"
  4. #include <string>
  5. using namespace cocos2d;
  6. using namespace std;
  7. class XMLAnalysis:public CCSAXDelegator,public CCObject//继承CCSAXDelegator,覆盖纯虚函数
  8. {
  9. public:
  10. XMLAnalysis(const char* data,unsigned int length);//解析数据
  11. XMLAnalysis(const char* filename);                    //解析文件
  12. ~XMLAnalysis(void);
  13. virtual void startElement(void *ctx, const char *name, const char **atts);//开始标签
  14. virtual void endElement(void *ctx, const char *name);                     //标签结束
  15. virtual void textHandler(void *ctx, const char *s, int len);              //标签的内容
  16. string rootname;
  17. };
  18. #endif
#ifndef XMLANALYSIS_H_H
#define XMLANALYSIS_H_H
#include "cocos2d.h"
#include <string>
using namespace cocos2d;
using namespace std;
class XMLAnalysis:public CCSAXDelegator,public CCObject//继承CCSAXDelegator,覆盖纯虚函数
{
public:XMLAnalysis(const char* data,unsigned int length);//解析数据XMLAnalysis(const char* filename);                     //解析文件~XMLAnalysis(void);virtual void startElement(void *ctx, const char *name, const char **atts);//开始标签virtual void endElement(void *ctx, const char *name);                     //标签结束virtual void textHandler(void *ctx, const char *s, int len);              //标签的内容string rootname;
};
#endif

源文件

[cpp] view plaincopyprint?
  1. #include "XMLAnalysis.h"
  2. XMLAnalysis::XMLAnalysis(const char* data,unsigned int length)
  3. {
  4. CCSAXParser parser;           //定义解析
  5. if(parser.init("UTF-8")==0)   //不是utf-8就不解析了
  6. {
  7. CCLog("please use utf-8");
  8. return;
  9. }
  10. parser.setDelegator(this);   //设置解析的对象,这样就会调用解析的方法
  11. parser.parse(data,length);
  12. }
  13. XMLAnalysis::XMLAnalysis(const char* filename)
  14. {
  15. CCSAXParser parser;
  16. if(parser.init("UTF-8")==0)
  17. {
  18. CCLog("please use utf-8");
  19. return;
  20. }
  21. parser.setDelegator(this);
  22. parser.parse(filename);
  23. }
  24. XMLAnalysis::~XMLAnalysis(void)
  25. {
  26. }
  27. void XMLAnalysis::startElement(void *ctx, const char *name, const char **atts)
  28. {
  29. if(strcmp(name,"root"))
  30. {
  31. rootname=name;
  32. }
  33. }
  34. void XMLAnalysis::textHandler(void *ctx, const char *s, int len)
  35. {
  36. string str=string(s,0,len);
  37. if(rootname!="")
  38. {
  39. CCLog("%s",str.c_str());
  40. }
  41. }
  42. void XMLAnalysis::endElement(void *ctx, const char *name)
  43. {
  44. rootname="";
  45. }
#include "XMLAnalysis.h"XMLAnalysis::XMLAnalysis(const char* data,unsigned int length)
{CCSAXParser parser;           //定义解析if(parser.init("UTF-8")==0)   //不是utf-8就不解析了{CCLog("please use utf-8");return;}parser.setDelegator(this);   //设置解析的对象,这样就会调用解析的方法parser.parse(data,length);
}
XMLAnalysis::XMLAnalysis(const char* filename)
{CCSAXParser parser;if(parser.init("UTF-8")==0){CCLog("please use utf-8");return;}parser.setDelegator(this);parser.parse(filename);
}XMLAnalysis::~XMLAnalysis(void)
{}
void XMLAnalysis::startElement(void *ctx, const char *name, const char **atts)
{if(strcmp(name,"root")){rootname=name;}
}
void XMLAnalysis::textHandler(void *ctx, const char *s, int len)
{string str=string(s,0,len);if(rootname!=""){CCLog("%s",str.c_str()); }
}void XMLAnalysis::endElement(void *ctx, const char *name)
{rootname="";
}

这样每次就打印出标签的内容。

下面使用CURL联网,从网络获取XML来解析,至于CURL联网的配置,请查看我的上一篇文章【Cocos2d-x游戏引擎开发笔记(24)】CURL实现get和post联网。定义一个静态变量std::string str;用于保存网络数据

[cpp] view plaincopyprint?
  1. static string str;
static string str;

在源文件中:

[cpp] view plaincopyprint?
  1. std::string HelloWorld::str;
std::string HelloWorld::str;

在按钮的点击事件中,开始联网:

[cpp] view plaincopyprint?
  1. void HelloWorld::menuCloseCallback(CCObject* pSender)
  2. {
  3. str="";
  4. //usePost();
  5. useGet();
  6. XMLAnalysis *p=new XMLAnalysis(str.c_str(),strlen(str.c_str()));//解析数据
  7. //XMLAnalysis *p=new XMLAnalysis("xmltemp.xml");                //解析文件
  8. delete p;
  9. }
void HelloWorld::menuCloseCallback(CCObject* pSender)
{str="";//usePost();useGet();XMLAnalysis *p=new XMLAnalysis(str.c_str(),strlen(str.c_str()));//解析数据//XMLAnalysis *p=new XMLAnalysis("xmltemp.xml");              //解析文件delete p;
}

这里联网是阻塞的,所以调用useGet之后,全部数据获得之后才开始解析的。下面是useGet的实现:

[cpp] view plaincopyprint?
  1. void HelloWorld::useGet()
  2. {
  3. CURL *curl;
  4. CURLcode res;
  5. curl=curl_easy_init();
  6. if(curl)
  7. {
  8. curl_easy_setopt(curl,CURLOPT_URL,"http://dota.uuu9.com/rss.xml");
  9. curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,writehtml);
  10. res=curl_easy_perform(curl);
  11. if(res!=CURLE_OK)
  12. {
  13. CCLog("联网超时 %i",res);
  14. }
  15. curl_easy_cleanup(curl);
  16. }
  17. else
  18. {
  19. CCLog("curl is null");
  20. return ;
  21. }
  22. }
void HelloWorld::useGet()
{CURL *curl;CURLcode res;curl=curl_easy_init();if(curl){curl_easy_setopt(curl,CURLOPT_URL,"http://dota.uuu9.com/rss.xml");curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,writehtml);res=curl_easy_perform(curl);if(res!=CURLE_OK){CCLog("联网超时 %i",res);}curl_easy_cleanup(curl);}else{CCLog("curl is null");return ;}
}

在writehtml函数中,将返回的数据全部保存到str中

[cpp] view plaincopyprint?
  1. size_t HelloWorld::writehtml(uint8_t* ptr,size_t size,size_t number,void *stream)
  2. {
  3. char* buffer=new char[16*1024+1];
  4. memset(buffer,0,16*1024+1);
  5. sprintf(buffer,"%s",ptr);
  6. CCLog("data length is %d",strlen(buffer));
  7. CCLog("size*number is %i",size*number);
  8. //CCLog("%s",ptr);
  9. str=str+buffer;
  10. delete []buffer;
  11. return size*number;//这里一定要放回实际返回的字节数
  12. }
size_t HelloWorld::writehtml(uint8_t* ptr,size_t size,size_t number,void *stream)
{char* buffer=new char[16*1024+1];memset(buffer,0,16*1024+1);sprintf(buffer,"%s",ptr);CCLog("data length is %d",strlen(buffer));CCLog("size*number is %i",size*number);//CCLog("%s",ptr);str=str+buffer;delete []buffer;return size*number;//这里一定要放回实际返回的字节数
}

这里我测试过,最大返回16k的数据,C Style字符串规定,最后一个字节是\0,所以多出一个字节存放\0。下面是从游久返回的数据,已经全部解析出来了:

[cpp] view plaincopyprint?
  1. DOTA
  2. 专题站 - 游久(U9)网 -DOTA6.66 - DOTA6.67 - DOTA6.66B - AI - DOTA - 地图下载
  3. http://dota.uuu9.com/
  4. 最专业的DOTA专题站,提供最全面最新的地图下载,大型英雄专题,英雄模拟器,录像,战报,攻略。最新,最快,最全,一切尽在DOTA.UUU9.COM
  5. zh-CN
  6. http://dota.uuu9.com/rss.xml
  7. [视频] 小满食尸鬼:笑容如何从脸上消失的
  8. http://dota.uuu9.com/201306/101447.shtml
  9. 您还没有安装flash播放器,请点击这里安装
  10. 2013-6-19 9:23:24
  11. http://dota.uuu9.com/201306/101447.shtml
  12. [视频] 黑曼巴出品:曼巴时刻top10第十二弹
  13. http://dota.uuu9.com/201306/101446.shtml
  14. 您还没有安装flash播放器,请点击这里安装
  15. 2013-6-19 9:17:19
  16. http://dota.uuu9.com/201306/101446.shtml
  17. [视频] 凯文教你打Carry:团战之王 幽鬼
  18. http://dota.uuu9.com/201306/101445.shtml
  19. 您还没有安装flash播放器,请点击这里安装
  20. 2013-6-19 9:07:31
  21. http://dota.uuu9.com/201306/101445.shtml
  22. [视频] WGT现场pis采访:暂不考虑征战DOTA2
  23. http://dota.uuu9.com/201306/101444.shtml
  24. 您还没有安装flash播放器,请点击这里安装
  25. 2013-6-18 18:49:37
  26. http://dota.uuu9.com/201306/101444.shtml
  27. [视频] Ks夫妻二人套路黑:拍拍与lion的故事
  28. http://dota.uuu9.com/201306/101443.shtml
  29. 您还没有安装flash播放器,请点击这里安装
  30. 2013-6-18 18:25:39
  31. http://dota.uuu9.com/201306/101443.shtml
  32. [视频] 抱抱熊出品:DOTA意识流特比拼VOL.38
  33. http://dota.uuu9.com/201306/101438.shtml
  34. 您还没有安装flash播放器,请点击这里安装
  35. 2013-6-18 17:02:51
  36. http://dota.uuu9.com/201306/101438.shtml
  37. [视频] 丶没有bi要出品:操作集锦 第六期
  38. http://dota.uuu9.com/201306/101434.shtml
  39. 您还没有安装flash播放器,请点击这里安装
  40. 2013-6-18 11:15:52
  41. http://dota.uuu9.com/201306/101434.shtml
  42. [视频] 抱抱熊出品:DOTA集锦每周TOP7第55期
  43. http://dota.uuu9.com/201306/101433.shtml
  44. 您还没有安装flash播放器,请点击这里安装
  45. 2013-6-18 11:02:16
  46. http://dota.uuu9.com/201306/101433.shtml
  47. [视频] ECL小组赛:Orange vs Rstars回顾
  48. http://dota2.uuu9.com/201306/446153.shtml
  49. 2013-6-18 10:36:35
  50. http://dota2.uuu9.com/201306/446153.shtml
  51. [视频] 专访GTL西北赛区线下赛嘉宾ZSMJ
  52. http://dota2.uuu9.com/201306/446152.shtml
  53. 2013-6-18 10:11:22
  54. http://dota2.uuu9.com/201306/446152.shtml
  55. [视频] Alienware Cup LGD vs DK两场回顾
  56. http://dota2.uuu9.com/201306/446139.shtml
  57. 2013-6-18 9:45:41
  58. http://dota2.uuu9.com/201306/446139.shtml
  59. [视频] 游久DOTA精彩集锦第一期:影魔时刻
  60. http://dota.uuu9.com/201306/101427.shtml
  61. 您还没有安装flash播放器,请点击这里安装
  62. 2013-6-18 8:43:42
  63. http://dota.uuu9.com/201306/101427.shtml
  64. [图赏] WGT颁奖图赏 Pis,Maybe高举奖杯
  65. http://dota.uuu9.com/201306/101425.shtml
  66. 2013-6-17 17:15:49
  67. http://dota.uuu9.com/201306/101425.shtml
  68. [视频] 牛蛙DOTA1/2拍拍熊:超神霸气的杀戮
  69. http://dota.uuu9.com/201306/101423.shtml
  70. 您还没有安装flash播放器,请点击这里安装
  71. 2013-6-17 15:45:31
  72. http://dota.uuu9.com/201306/101423.shtml
  73. [视频] 水友制作娱乐视频:蛋疼镜头集锦124期
  74. http://dota.uuu9.com/201306/101419.shtml
  75. 您还没有安装flash播放器,请点击这里安装
  76. 2013-6-17 14:54:53
  77. http://dota.uuu9.com/201306/101419.shtml
  78. [视频] ZEAM出品教父制作:捣塔冷笑话第五弹
  79. http://dota.uuu9.com/201306/101417.shtml
  80. 您还没有安装flash播放器,请点击这里安装
  81. 2013-6-17 14:41:16
  82. http://dota.uuu9.com/201306/101417.shtml
  83. [视频] 浅雪dota:教大家打先手(纯属娱乐)
  84. http://dota.uuu9.com/201306/101421.shtml
  85. 您还没有安装flash播放器,请点击这里安装
  86. 2013-6-17 12:15:43
  87. http://dota.uuu9.com/201306/101421.shtml
  88. [视频] WGT总决赛Greedy战胜LJBF视频回顾
  89. http://dota.uuu9.com/201306/101413.shtml
  90. WGT线下赛总决赛 Greedy VS LJBF
  91. 2013-6-17 11:45:02
  92. http://dota.uuu9.com/201306/101413.shtml
  93. [视频] 彩笔制作:DOTA反杀集锦Top10第64期
  94. http://dota.uuu9.com/201306/101412.shtml
  95. 您还没有安装flash播放器,请点击这里安装
  96. 2013-6-17 11:31:17
  97. http://dota.uuu9.com/201306/101412.shtml
  98. [视频] DotA搞笑视频:论演员自我修养第五期
  99. http://dota.uuu9.com/201306/101411.shtml
  100. 您还没有安装flash播放器,请点击这里安装
  101. 2013-6-17 11:05:58
  102. http://dota.uuu9.com/201306/101411.shtml
  103. [视频] 每周DOTA搞笑镜头:FunnyTOP10第78期
  104. http://dota.uuu9.com/201306/101410.shtml
  105. 您还没有安装flash播放器,请点击这里安装
  106. 2013-6-17 10:57:31
  107. http://dota.uuu9.com/201306/101410.shtml
  108. [视频] 小乖第一视角:酣畅淋漓的影魔二连发
  109. http://dota.uuu9.com/201306/101409.shtml
  110. 您还没有安装flash播放器,请点击这里安装
  111. 2013-6-17 9:42:07
  112. http://dota.uuu9.com/201306/101409.shtml
  113. [视频] Nada从顶单排10:中单巫医与中单流浪
  114. http://dota.uuu9.com/201306/101408.shtml
  115. 您还没有安装flash播放器,请点击这里安装
  116. 2013-6-17 9:33:45
  117. http://dota.uuu9.com/201306/101408.shtml
  118. [视频] P神怒秀sf WGT胜者组Greedy vs PMM
  119. http://dota.uuu9.com/201306/101402.shtml
  120. WGT胜者组决赛Greedy vs PMM视频回顾
  121. 2013-6-16 12:32:10
  122. http://dota.uuu9.com/201306/101402.shtml
  123. [视频] 满楼水平第一视角:跳刀沙王就是干
  124. http://dota.uuu9.com/201306/101405.shtml
  125. 您还没有安装flash播放器,请点击这里安装
  126. 2013-6-16 12:28:48
  127. http://dota.uuu9.com/201306/101405.shtml
  128. [视频] ks从1800单排9-11:火女,女王,毒狗
  129. http://dota.uuu9.com/201306/101404.shtml
  130. 您还没有安装flash播放器,请点击这里安装
  131. 2013-6-16 12:22:02
  132. http://dota.uuu9.com/201306/101404.shtml
  133. [视频] 直播回顾 浅浅打野斧王第一视角
  134. http://dota.uuu9.com/201306/101401.shtml
  135. 您还没有安装flash播放器,请点击这里安装
  136. 2013-6-16 11:54:02
  137. http://dota.uuu9.com/201306/101401.shtml
  138. [视频] DOTA直播回顾:天使焦先知第一视角
  139. http://dota.uuu9.com/201306/101400.shtml
  140. 您还没有安装flash播放器,请点击这里安装
  141. 2013-6-16 11:48:13
  142. http://dota.uuu9.com/201306/101400.shtml
  143. [图赏] WGT2013现场图赏 PIS再战职业首秀
  144. http://dota.uuu9.com/201306/101393.shtml
  145. 2013-6-15 14:30:08
  146. http://dota.uuu9.com/201306/101393.shtml
  147. [视频] 小满鱼人第一视角:重回高手房匹配
  148. http://dota.uuu9.com/201306/101392.shtml
  149. 您还没有安装flash播放器,请点击这里安装
  150. 2013-6-15 13:14:32
  151. http://dota.uuu9.com/201306/101392.shtml
  152. [视频] 舞儿蓝猫第一视角:劣势局飘逸逆袭
  153. http://dota.uuu9.com/201306/101391.shtml
  154. 您还没有安装flash播放器,请点击这里安装
  155. 2013-6-15 13:09:42
  156. http://dota.uuu9.com/201306/101391.shtml
  157. [视频] 凯文教你打Carry:4V5的翻盘小黑
  158. http://dota.uuu9.com/201306/101385.shtml
  159. 您还没有安装flash播放器,请点击这里安装
  160. 2013-6-15 0:43:04
  161. http://dota.uuu9.com/201306/101385.shtml
  162. [视频] Ks从1800单排7-8:老虎,先知无剧透
  163. http://dota.uuu9.com/201306/101382.shtml
  164. 您还没有安装flash播放器,请点击这里安装
  165. 2013-6-14 16:51:55
  166. http://dota.uuu9.com/201306/101382.shtml
  167. [视频] 820dota第一视角:6.78新版暴力武士
  168. http://dota.uuu9.com/201306/101377.shtml
  169. 您还没有安装flash播放器,请点击这里安装
  170. 2013-6-14 14:25:53
  171. http://dota.uuu9.com/201306/101377.shtml
  172. [视频] 09从零单排第二季41-42:山岭黑鸟
  173. http://dota.uuu9.com/201306/101376.shtml
  174. 您还没有安装flash播放器,请点击这里安装
  175. 2013-6-14 14:13:57
  176. http://dota.uuu9.com/201306/101376.shtml
  177. [视频] Zero_C出品:极限反杀Top10 臂章特辑
  178. http://dota.uuu9.com/201306/101372.shtml
  179. 您还没有安装flash播放器,请点击这里安装
  180. 2013-6-14 10:24:41
  181. http://dota.uuu9.com/201306/101372.shtml
  182. [视频] 牛蛙月骑第一视角:拉远古极限FARM
  183. http://dota.uuu9.com/201306/101370.shtml
  184. 您还没有安装flash播放器,请点击这里安装
  185. 2013-6-14 9:30:59
  186. http://dota.uuu9.com/201306/101370.shtml
  187. [视频] Nada从顶单排9:撼地神牛第一视角
  188. http://dota.uuu9.com/201306/101369.shtml
  189. 您还没有安装flash播放器,请点击这里安装
  190. 2013-6-14 9:22:33
  191. http://dota.uuu9.com/201306/101369.shtml
  192. [视频] Ks水友赛第一周:天差地别的两盘给跪
  193. http://dota.uuu9.com/201306/101368.shtml
  194. 您还没有安装flash播放器,请点击这里安装
  195. 2013-6-14 9:15:24
  196. http://dota.uuu9.com/201306/101368.shtml
  197. [视频] 小乖顶端的开始7:激情影魔小鱼合集
  198. http://dota.uuu9.com/201306/101364.shtml
  199. 您还没有安装flash播放器,请点击这里安装
  200. 2013-6-13 16:12:29
  201. http://dota.uuu9.com/201306/101364.shtml

DOTA
专题站 - 游久(U9)网 -DOTA6.66 - DOTA6.67 - DOTA6.66B - AI - DOTA - 地图下载
http://dota.uuu9.com/
最专业的DOTA专题站,提供最全面最新的地图下载,大型英雄专题,英雄模拟器,录像,战报,攻略。最新,最快,最全,一切尽在DOTA.UUU9.COM
zh-CN
http://dota.uuu9.com/rss.xml[视频] 小满食尸鬼:笑容如何从脸上消失的
http://dota.uuu9.com/201306/101447.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-19 9:23:24
http://dota.uuu9.com/201306/101447.shtml[视频] 黑曼巴出品:曼巴时刻top10第十二弹
http://dota.uuu9.com/201306/101446.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-19 9:17:19
http://dota.uuu9.com/201306/101446.shtml[视频] 凯文教你打Carry:团战之王 幽鬼
http://dota.uuu9.com/201306/101445.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-19 9:07:31
http://dota.uuu9.com/201306/101445.shtml[视频] WGT现场pis采访:暂不考虑征战DOTA2
http://dota.uuu9.com/201306/101444.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-18 18:49:37
http://dota.uuu9.com/201306/101444.shtml[视频] Ks夫妻二人套路黑:拍拍与lion的故事
http://dota.uuu9.com/201306/101443.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-18 18:25:39
http://dota.uuu9.com/201306/101443.shtml[视频] 抱抱熊出品:DOTA意识流特比拼VOL.38
http://dota.uuu9.com/201306/101438.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-18 17:02:51
http://dota.uuu9.com/201306/101438.shtml[视频] 丶没有bi要出品:操作集锦 第六期
http://dota.uuu9.com/201306/101434.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-18 11:15:52
http://dota.uuu9.com/201306/101434.shtml[视频] 抱抱熊出品:DOTA集锦每周TOP7第55期
http://dota.uuu9.com/201306/101433.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-18 11:02:16
http://dota.uuu9.com/201306/101433.shtml[视频] ECL小组赛:Orange vs Rstars回顾
http://dota2.uuu9.com/201306/446153.shtml2013-6-18 10:36:35
http://dota2.uuu9.com/201306/446153.shtml[视频] 专访GTL西北赛区线下赛嘉宾ZSMJ
http://dota2.uuu9.com/201306/446152.shtml2013-6-18 10:11:22
http://dota2.uuu9.com/201306/446152.shtml[视频] Alienware Cup LGD vs DK两场回顾
http://dota2.uuu9.com/201306/446139.shtml2013-6-18 9:45:41
http://dota2.uuu9.com/201306/446139.shtml[视频] 游久DOTA精彩集锦第一期:影魔时刻
http://dota.uuu9.com/201306/101427.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-18 8:43:42
http://dota.uuu9.com/201306/101427.shtml[图赏] WGT颁奖图赏 Pis,Maybe高举奖杯
http://dota.uuu9.com/201306/101425.shtml2013-6-17 17:15:49
http://dota.uuu9.com/201306/101425.shtml[视频] 牛蛙DOTA1/2拍拍熊:超神霸气的杀戮
http://dota.uuu9.com/201306/101423.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-17 15:45:31
http://dota.uuu9.com/201306/101423.shtml[视频] 水友制作娱乐视频:蛋疼镜头集锦124期
http://dota.uuu9.com/201306/101419.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-17 14:54:53
http://dota.uuu9.com/201306/101419.shtml[视频] ZEAM出品教父制作:捣塔冷笑话第五弹
http://dota.uuu9.com/201306/101417.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-17 14:41:16
http://dota.uuu9.com/201306/101417.shtml[视频] 浅雪dota:教大家打先手(纯属娱乐)
http://dota.uuu9.com/201306/101421.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-17 12:15:43
http://dota.uuu9.com/201306/101421.shtml[视频] WGT总决赛Greedy战胜LJBF视频回顾
http://dota.uuu9.com/201306/101413.shtml
WGT线下赛总决赛 Greedy VS LJBF
2013-6-17 11:45:02
http://dota.uuu9.com/201306/101413.shtml[视频] 彩笔制作:DOTA反杀集锦Top10第64期
http://dota.uuu9.com/201306/101412.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-17 11:31:17
http://dota.uuu9.com/201306/101412.shtml[视频] DotA搞笑视频:论演员自我修养第五期
http://dota.uuu9.com/201306/101411.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-17 11:05:58
http://dota.uuu9.com/201306/101411.shtml[视频] 每周DOTA搞笑镜头:FunnyTOP10第78期
http://dota.uuu9.com/201306/101410.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-17 10:57:31
http://dota.uuu9.com/201306/101410.shtml[视频] 小乖第一视角:酣畅淋漓的影魔二连发
http://dota.uuu9.com/201306/101409.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-17 9:42:07
http://dota.uuu9.com/201306/101409.shtml[视频] Nada从顶单排10:中单巫医与中单流浪
http://dota.uuu9.com/201306/101408.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-17 9:33:45
http://dota.uuu9.com/201306/101408.shtml[视频] P神怒秀sf WGT胜者组Greedy vs PMM
http://dota.uuu9.com/201306/101402.shtml
WGT胜者组决赛Greedy vs PMM视频回顾
2013-6-16 12:32:10
http://dota.uuu9.com/201306/101402.shtml[视频] 满楼水平第一视角:跳刀沙王就是干
http://dota.uuu9.com/201306/101405.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-16 12:28:48
http://dota.uuu9.com/201306/101405.shtml[视频] ks从1800单排9-11:火女,女王,毒狗
http://dota.uuu9.com/201306/101404.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-16 12:22:02
http://dota.uuu9.com/201306/101404.shtml[视频] 直播回顾 浅浅打野斧王第一视角
http://dota.uuu9.com/201306/101401.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-16 11:54:02
http://dota.uuu9.com/201306/101401.shtml[视频] DOTA直播回顾:天使焦先知第一视角
http://dota.uuu9.com/201306/101400.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-16 11:48:13
http://dota.uuu9.com/201306/101400.shtml[图赏] WGT2013现场图赏 PIS再战职业首秀
http://dota.uuu9.com/201306/101393.shtml2013-6-15 14:30:08
http://dota.uuu9.com/201306/101393.shtml[视频] 小满鱼人第一视角:重回高手房匹配
http://dota.uuu9.com/201306/101392.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-15 13:14:32
http://dota.uuu9.com/201306/101392.shtml[视频] 舞儿蓝猫第一视角:劣势局飘逸逆袭
http://dota.uuu9.com/201306/101391.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-15 13:09:42
http://dota.uuu9.com/201306/101391.shtml[视频] 凯文教你打Carry:4V5的翻盘小黑
http://dota.uuu9.com/201306/101385.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-15 0:43:04
http://dota.uuu9.com/201306/101385.shtml[视频] Ks从1800单排7-8:老虎,先知无剧透
http://dota.uuu9.com/201306/101382.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-14 16:51:55
http://dota.uuu9.com/201306/101382.shtml[视频] 820dota第一视角:6.78新版暴力武士
http://dota.uuu9.com/201306/101377.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-14 14:25:53
http://dota.uuu9.com/201306/101377.shtml[视频] 09从零单排第二季41-42:山岭黑鸟
http://dota.uuu9.com/201306/101376.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-14 14:13:57
http://dota.uuu9.com/201306/101376.shtml[视频] Zero_C出品:极限反杀Top10 臂章特辑
http://dota.uuu9.com/201306/101372.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-14 10:24:41
http://dota.uuu9.com/201306/101372.shtml[视频] 牛蛙月骑第一视角:拉远古极限FARM
http://dota.uuu9.com/201306/101370.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-14 9:30:59
http://dota.uuu9.com/201306/101370.shtml[视频] Nada从顶单排9:撼地神牛第一视角
http://dota.uuu9.com/201306/101369.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-14 9:22:33
http://dota.uuu9.com/201306/101369.shtml[视频] Ks水友赛第一周:天差地别的两盘给跪
http://dota.uuu9.com/201306/101368.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-14 9:15:24
http://dota.uuu9.com/201306/101368.shtml[视频] 小乖顶端的开始7:激情影魔小鱼合集
http://dota.uuu9.com/201306/101364.shtml
您还没有安装flash播放器,请点击这里安装
2013-6-13 16:12:29
http://dota.uuu9.com/201306/101364.shtml

这里我感觉到有点奇怪,这里解析出来的数据比服务器返回的数据要少。以前我在做Android解析XML的时候也是仅仅解析出来了一半,不过使用纯java的话,是可以全部解析出来的。这应该是从游久返回的数据有问题,我解析从自己搭建的服务器返回的数据是完美的。

一般情况下我是要上传工程的源代码的,这次上传出了问题,过几天再上传吧。

【Cocos2d-x游戏引擎开发笔记(25)】XML解析相关推荐

  1. 简单游戏引擎开发笔记(一)

    ---恢复内容开始--- 一.游戏引擎简介 1.概念 游戏引擎是指一些已编写好的可编辑电脑游戏系统或者一些互交式实时图像应用程序的核心组件.这些系统为游戏设计者提供各种编写游戏所需的各种工具,其目的在 ...

  2. libgdx游戏引擎开发笔记(一)引擎介绍和Helloworld

       做Android快一年了,项目也做了四五个,感觉没什么动力向前,思绪整理了一段时间,决定转入Android游戏开发,同时发现了一款强大的游戏引擎libgdx,在此边学边整理,好记性不如烂笔头嘛! ...

  3. libgdx游戏引擎开发笔记(十)SuperJumper游戏例子的讲解(篇四)---- 主游戏界面内部框架编写...

    上一讲,我们已经实现了点击play进入游戏界面但仅仅是个黑屏  今天,我们就试着编写代码让它出现游戏的一些简单场景.还是在上一讲的代码基础上,我们创建两个类:World 和 WorldRenderer ...

  4. libgdx游戏引擎开发笔记(十三)SuperJumper游戏例子的讲解(篇七)----各个物体的创建及其碰撞检测...

       接着上一篇,我们完成后续的扫尾工作:游戏中个物体创建及其碰撞检测,分数保存,音效处理. 1.World类:(加入所有物体,及其碰撞检测,代码里有详细注解) package com.zhf.myl ...

  5. 【Cocos2d-x游戏引擎开发笔记(13)】Tiled Map Editor(一)

    原创文章,转载请注明出处:http://blog.csdn.net/zhy_cheng/article/details/8308609 Tiled Map Editor是Cocos2d-x支持的地图编 ...

  6. 用C++实现跨平台游戏引擎开发

    游戏开发系列 用C++实现跨平台游戏引擎开发 你是否梦想写一部格斗游戏但却无从着手呢?是否你只因游戏开发好玩而对之感兴趣?本文我们将分析一个通用的跨平台游戏引擎,每个游戏开发新手都可以自由地使用它. ...

  7. unity应用开发实战案例_Unity3D游戏引擎开发实战从入门到精通

    Unity3D游戏引擎开发实战从入门到精通(坦克大战项目实战.NGUI开发.GameObject) 一.Unity3D游戏引擎开发实战从入门到精通是怎么样的一门课程(介绍) 1.1.Unity3D游戏 ...

  8. 游戏系统开发笔记(六)——服务端架构设计

    . http://blog.csdn.net/mooke/article/details/8913051 上回写了写服务端的分层结构,分层是比较宏观上的东西,至于层次间具体的交互方式还得通过各个模块的 ...

  9. 游戏系统开发笔记(三)——通用代码库

    墨水比较有限,工作时基本也都是着眼小处,除了工作内容涉及过的几个模块,其余的暂时并未多作关注,所以基本上还只是停留在感性认识上.不过我倒觉得这是难免,毕竟游戏产品放到整个软件行业来说也是个较复杂的东西 ...

  10. 游戏引擎开发和物理引擎_视频游戏开发的最佳游戏引擎

    游戏引擎开发和物理引擎 In this article, we'll look at some of the most popular game engines for video game deve ...

最新文章

  1. 语言中拟合函数 计算aic_Go语言函数深度解析(中)
  2. 爬虫推特数据分析的外文文献_13天让你学会爬虫分布式,说到让你做到择推出it届附教程...
  3. 训练集山准确率高测试集上准确率很低_推荐算法改版前的AB测试
  4. NET问答: 重写了 Equals,还有必要重写 GetHashCode 吗?
  5. 微软是如何使用 C# 重写 C# 编译器并将其开源的
  6. Jquery实战——横纵向的菜单
  7. 记一次生成唯一ID的问题
  8. transforms.Compose()函数
  9. 密文恢复出明文的过程称为_整流二极管的反向恢复过程图解
  10. Facebook将偷来的3D对象数据库用于其AI项目:被诉讼
  11. Android应用内存泄漏的定位、分析与解决策略 1
  12. 20180514-A · Star Wars Survey · ggplot2 ggdraw geom_bar facet_grid magick 柱状图 条形图 · R 语言数据可视化 案例 源码
  13. scratch编程小游戏——黄金矿工
  14. 仿支付宝头像外加一个边框的工具类
  15. 链公公 x 凰药师 x 元天益生:供应链金融支持健康与科技农业 |Chain++
  16. 谈谈win10的简单美化
  17. numpy 处理txt的简单样例
  18. Jenkins自动化部署(java+maven+tomcat项目)
  19. 算法刷题路线总结与相关资料分享
  20. ZJOI2019 麻将

热门文章

  1. 安规电容与普通电容的区别
  2. excel vba 数据分析
  3. python算法练习——解空间的穷举搜索与Google方程式
  4. 【最新】国内外激光雷达盘点及核心产品介绍
  5. 【备忘】Aegisub字幕制作简易方法
  6. 360极速浏览器配置Chromedrive
  7. 移动交互设计:提示语设计总结
  8. 服务器浏览器怎么打不开网页,电脑能上qq打不开网页怎么回事?
  9. 让你搞懂 administrator最高权限
  10. android点歌系统代码