If you know some French AND Civ4 XML I need help

primem0ver

Emperor
Joined
Jun 16, 2006
Messages
1,158
Location
Peoria, AZ
I have yet another issue with what appears to be a bad habit of Firaxis' of writing careless XML for text tags.

I have already had to compensate for the fact that two tags with the same name can be of type "textOnly" or "eltOnly" (there is no actual schema for text files).

For example... a language tag can be in the format:
Code:
<French>%s2_player donne %d3_gold [ICON_GOLD]/tour à %s1_player pour couvrir ses dépenses.</French>

This means it is to be interpreted as a textOnly tag.

OR it can be in this format:
Code:
<French>
	<Text>Jeju</Text>
	<Gender>Male</Gender>
	<Plural>0</Plural>
</French>

This is the format for an "eltOnly" or what I call a "container" tag. Notice that they have the same name (which as far as I know is not allowed in standard schema's).

Even though I have developed a way to handle this duplicity... now I have another problem that I found when the editor reads the text data for TXT_KEY_PERIANDER_HAGNON. Neither my editor nor I know how to deal with this:
Code:
<French>Périandre
	<Text>Pittacus</Text>
	<Gender>Male</Gender>
	<Plural>0</Plural>
</French>

Technically speaking this is BOTH a textOnly tag and an eltOnly tag. Perhaps XML standards allow this... but I can't tell if this is a mistake, or if I need to write code to read it as both.

Can anyone tell me if this is a mistake? Is the first part "Périandre" part of this guys French name? Or is his French name Pittacus?
 
From which mod is that?
Because that just seems to be broken for me, a bug. That first text shouldn't be where it is.


LOL... yeah Im thinking that myself but I want to make sure. It's the original CIV4GameText_Warlords.xml file. Check it out your yourself.

Ever since I have written an engine to analyze the schema and making sure the schema is followed when xml is imported I have come across several mistakes in the original XML coding. It has been a source of significant frustration. I have had to write error handling routines and an exceptions file so that the engine can read the files without complaining and without changing the original code. And as I said above I had to write special case handling for text files because of the ambiguous coding. I know people make mistakes... but this is a bit much.
 
Technically, that would be an example of content="mixed". This is a perfectly valid setting for XML.

On the other hand, what it means in this case in the context of the game is unknown. I would guess it is a mistake - probably somebody was a bit overzealous with the cut and paste and didn't delete what they didn't need, or made a change in the wrong place. Since the key mentions PERIANDER, I would guess that either the additional tags are the mistake since the plain text part matches but the Text tag does not, or the initial text was supposed to replace what is in the Text element. There is no good way for your program to figure out which part is correct. Perhaps it could save that XML data unparsed as a simple chunk of text and tell the user that "this is wrong" and display the unparsed XML. Alternatively, you could check to see what actually shows up in game for that text key and do what it does - presumably it throws away one of the two things (my guess would be that it uses the plain text rather than the included tags or someone would have noticed that the text is wrong, based on the name of the text key).
 
Hm. I just cehcked the source fiel and it's messed up even more than you are indicating.
Code:
	<TEXT>
		<Tag>TXT_KEY_PERIANDER_HAGNON</Tag>
		<English>Periander</English>
		[B][COLOR="DarkRed"]<Text>Pittacus</Text>
		<Gender>Male</Gender>[/COLOR][/B]
		<French>[B][COLOR="darkred"]Périandre
			<Text>Pittacus</Text>
			<Gender>Male</Gender>
			<Plural>0</Plural>[/COLOR][/B]
		</French>
		<German>
			<Text>Periander</Text>
			<Gender>Male</Gender>
			<Plural>0</Plural>
		</German>
		<Italian>
			<Text>Periandro</Text>
			<Gender>Male</Gender>
			<Plural>0</Plural>
		</Italian>
		<Spanish>
			<Text>Periander</Text>
			<Gender>Male</Gender>
			<Plural>0</Plural>
		</Spanish>
	</TEXT>

In between the English and French there is a pair of extraneous Text and Gender tags, outside of any language, as well as a messed up French entry.

I'm guessing that nobody noticed the weirdness because this particular text key is never used. It doesn't appear an any other XML (or Python) file in Warlords, including the mods.
 
Yes... I noticed that too. I built an ini based "schema" to handle text tags and this entire entry caused a few issues. To overcome this I changed my "schema" a bit to make the English Text and Gender tags optional (minOccurs = 0). That was before I noticed that in other places the English textOnly tags are replaced by eltOnly tags. So when I came back to this particular entry, I thought that maybe the English tag was a typo as well.

I discovered this new problem when I was using a file comparer to see how well my XML writer followed the original format for Civ text files. They were identical except for the one change I purposefully made and this particular tag (and one other small glitch I have already fixed).

It works exactly as you describe. Currently the editor reads the text tag ignoring the elt verson of the french tag. However, I thought this might be an issue when saving the file because the elt version doesn't get saved. If the elt version is wrong and this is a mistake, I won't worry about it. My editor will actually correct the mistake without overwriting the original file (since it only saves into mod folders).
 
BTW J... I love your little comment about Steam in your signature. Steam is one of the 3 key reasons why I won't play Civ5. Hopefully if Firaxis releases a Civ 6, they will avoid forcing the user to deal with a third party. Especially such a crappy one.
 
Back
Top Bottom