1

现在,我通过简单地重写用户请求的文件来保存我的数据。我的 xml 的结构是这样的:

Skeleons root
    Skeleton with string name attribute
       bone with attributes
       bone with attributes
       bone with attributes
       bone with attributes
    end Skeleton
   Skeleton with string name attribute
       bone with attributes
       bone with attributes
       bone with attributes
       bone with attributes
    end Skeleton
    ....
   end Skeletons root

我遍历以查看所需名称的骨架是否存在,如果存在,我想完全重写它。如果没有,我想将它添加到根元素的底部。

有没有人有这方面的例子?

谢谢

4

1 回答 1

1

基本上,这只是拆分步骤的问题。

首先,定义 aTiXmlElement *并将其设置为 0。遍历 的所有子级Skeletons。如果您找到正确的Skeleton,请指出TiXmlElement *它。

其次,如果你还没有找到它(TiXmlElement *仍然是 0),创建一个新的骨架并指向TiXmlElement *它。

最后,在它下面创建一个新骨骼TiXmlElement *

于 2011-08-18T15:05:57.793 回答