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

基本的に、これはステップを分割するだけの問題です。

まず、 a を定義しTiXmlElement *て 0 に設定します。 のすべての子に対して繰り返しますSkeletons。正しい が見つかったら、それSkeletonを指してくださいTiXmlElement *

次に、見つからない場合 (TiXmlElement *まだ 0)、新しいスケルトンを作成し、それをポイントTiXmlElement *します。

最後に、その下に新しいボーンを作成しますTiXmlElement *

于 2011-08-18T15:05:57.793 に答える