我目前有一个带有以下代码的xml:
<Level>
<!--Loads the animals for the Level-->
<Animal>
<Texture>panda.png</Texture>
<PositionX>100</PositionX>
<PositionY>50</PositionY>
<Type>Panda</Type>
</Animal>
<Animal>
<Texture>tiger.png</Texture>
<PositionX>200</PositionX>
<PositionY>150</PositionY>
<Type>Tiger</Type>
</Animal>
<Animal>
<Texture>monkey.png</Texture>
<PositionX>300</PositionX>
<PositionY>250</PositionY>
<Type>Monkey</Type>
</Animal>
</Level>
我想要的是摆脱 positionX 和 positionY 并用 CGPoint 变量替换它。这将使我稍后将在包含多个位置的行中添加的其他项目更容易。
我搜索了互联网,但找不到 GDataXML 的任何文档。
为了得到我的字符串和整数,我在我的 GDataXMLElement 上使用了 .stringValue 和 .intValue。
我的问题是,GDataXML 是否有可能从 xml 文件中获取 CGPoint 值,或者我是否必须像我目前拥有的那样将其作为单独的整数来执行?