Right now, I save my data by simply rewriting the file requested by the user. The way my xml is structured is like this:
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
I iterate through to see if the skeleton of desired name exists and if it does I want to completely rewrite it. If not, I want to add it to the bottom of the root element.
Does anyone have an example of this?
Thanks
Basically, this is just a matter of splitting the steps.
First, define a
TiXmlElement *and set it to 0. Iterate over all children ofSkeletons. If you find the correctSkeleton, point yourTiXmlElement *to it.Secondly, if you haven’t found it (
TiXmlElement *still 0), create a new Skeleton and point yourTiXmlElement *to it.Finally, create a new bone underneath that
TiXmlElement *.