Community Forum

Parse items.xml

Forum Overview >> Scripting

CategoryScripting
Created23.12.2020 14:41


Brian Thompson (tommert) 23.12.2020 14:41
Folks, I want to parse the items.xml file for my savegame. I'm trying to periodically print to log the animal data that is contained so that I can see, roughly, how many weeks since cows gave birth and have until they give birth again.

For example, this line:
<animal fillType="COW_TYPE_BLACK_WHITE" dirtScale="0.000000" seasons_isFemale="true" seasons_weight="564.516907" seasons_age="2.792796" seasons_id="123" seasons_timeUntilBirth="0.069078" seasons_timeSinceBirth="0.941787"/>

I'll print in a table and show:
Age, ID, Time until birth, Time since Birth

And the information read from xml will be changed. I'll read age, and both birth attributes and multiply by 365

How do I traverse the xml tree and iterate over all the animals?


Note: Log in to post. Create a new account here.