问题描述
我想从每个行星和小行星中提取数据(在本例中不是)并将其放在字符串列表中。 因此,一个行星列表将包含(按顺序):
- 名称
- x位置
- 位置y
- 半径
- 速度x
- 速度y (任何)-邻居
遍历xml时遇到很多麻烦,并且此imo上没有很多好的教程。
xml:
<galaxy>
<planet>
<name>Kobol</name>
<position>
<x>45</x>
<y>310</y>
<radius>7</radius>
</position>
<speed>
<x>0.3</x>
<y>-0.6</y>
</speed>
<neighbours>
<planet>Unicron</planet>
<planet>Koarth</planet>
</neighbours>
<color>blue</color>
<oncollision>blink</oncollision>
</planet>
<planet>
<name>Namek</name>
<position>
<x>60</x>
<y>102</y>
<radius>15</radius>
</position>
<speed>
<x>0.1</x>
<y>0.2</y>
</speed>
<neighbours>
<planet>Helicon</planet>
<planet>Synnax</planet>
<planet>Xenex</planet>
<planet>Alderaan</planet>
</neighbours>
<color>orange</color>
<oncollision>blink</oncollision>
</planet>
</galaxy>
有人可以帮忙吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)