View Full Version : Error with xml after editing units


CivMarine
May 24, 2007, 03:30 AM
I am getting this error after editing the units with wordpad.
Failed loading xml file xml\units/civ4unitinfos.xml
[.\FXml.cpp.133] Error parsing xml file
File: xml\units/civ4unitinfos.xml
Reason: Element content is invalid according to the DTD/ Schema
Expecting {x-schema:Civ4unitschema.xml}PrereqBonuses
Line 10811, 15
Source: <BonusType>Bonus_Uranium</BonusType>
Load xml failed for units/civ4unitsinfos.xml
Current xml: units/civ4buildinfos
Then it goes on to tell me that the class infos for all the Country unit specifics are wrong i.e. navyseal-american, panzer-german, cossack-russian etc etc. Have I forgotten to do something somwhere? Please help! Thank you.:mad: :confused:

Chamaedrys
May 24, 2007, 09:25 AM
You've made little little mistake in the civ4unitinfos. Maybe you mispelled something or forgot a "/". Now the game is unable to load this file. So the game has no info about units. And this leads to probs with other files...

the solution:

Line 10811, 15
Source: <BonusType>Bonus_Uranium</BonusType>

check the mentioned line in the unitinfos and correct the mistake.;)

Zebra 9
May 24, 2007, 11:32 AM
Well, cIV is case sensitive so maybe try changing <BonusType>Bonus_Uranium</BonusType> to <BonusType>BONUS_URANIUM</BonusType> and it might work.:thumbsup:

strategyonly
May 24, 2007, 01:27 PM
If all else fails just post a copy of the files you changed here, and someone MIGHT take a look, ok.

CivMarine
May 24, 2007, 02:21 PM
I think it has something to do with the bonuses I am trying to use to 'have' to build the unit. i.e.: the destroyer; I want to have whomever is building the ship to have to have the resources iron, oil, and uranium. I don't know if I have put them in the wrong perameter or what. I still don't understand why all the classes are messed up. Thanks for the help everyone.
This is my unitinfos file(please don't make fun of it, it is mine :) ) :
http://forums.civfanatics.com/uploads/116628/CIV4UnitInfos.rar

ohcrapitsnico
May 24, 2007, 02:48 PM
You shoudl use notepad instead of wordpad, I don't know if it makes a difference or not but I think wordpad causes problems.

Chamaedrys
May 24, 2007, 02:58 PM
I have found the bug:

<BonusType>BONUS_OIL</BonusType>
<BonusType>BONUS_IRON</BonusType>

You cant add or remove a line without changing the sdk.

But you can have several "PrereqBonuses":

<BonusType>BONUS_IRON</BonusType>
<PrereqBonuses>
<BonusType>BONUS_OIL</BonusType>
<BonusType>BONUS_URANIUM</BonusType>
<BonusType>NONE</BonusType>
<BonusType>NONE</BonusType>
</PrereqBonuses>

CivMarine
May 24, 2007, 03:07 PM
Thanks a lot Chamaedrys. What about the unit upgrade? Can I erase that without changing the sdk?

Chamaedrys
May 24, 2007, 03:16 PM
Thanks a lot Chamaedrys. What about the unit upgrade? Can I erase that without changing the sdk?

Yes, units without an upgrade have just a <UnitClassUpgrades/>;)

CivMarine
May 24, 2007, 03:25 PM
That's what I figured. Just thought I would make sure. I hate to ask more of you since you have helped me so much already, but can I add upgrades? i.e.
unit swordsman:
<UnitClassUpgrade>
<UnitClassUpgradeType>UNITCLASS_KNIGHT</UnitClassUpgradeType>
<bUnitClassUpgrade>1</bUnitClassUpgrade>
</UnitClassUpgrade>
Sorry I am somewhat a noob, I know more than most, but not as much as many. Thanks for putting up with my annoyance.

strategyonly
May 24, 2007, 04:08 PM
See told you someone MIGHT help, but you always get those few idiots that have nothing better to do than rate MODs with a 1 star, IDIOTS, LOL
Glad you got some help!!!

CivMarine
May 24, 2007, 10:13 PM
CASE CLOSED! Thanks for all the help everyone. This is a great site!