Please see this pull request

TransGenesis uses the Java StAX Parser in order to load XML files. The parser requires for XML files to be "well-formed", meaning that they follow some strict rules. I have been able to find workarounds for some XML problems. For instance, the way that Transcendence uses Modules with external entities is unfamiliar to the parser, but I was able to skip external entity resolution by replacing all instances of & with &). The only issue as of now is that element tags cannot start with a digit, and it only occurs in three lines of code relating to Domina donation static data.

Using well-formed XML will improve general compatibility with editors.

george moromisato 21 Jul 2017:

I will also change the XML parser to return errors in these cases (probably in debug-mode only).

giantcabbage 21 Jul 2017:

Both 0xabcdef and nms fixed this by renaming the element (e.g. 00182001_Donation to Donation_00182001). Would it be preferable also switch to using the id attribute to identify the data?

i.e. in older code (TransCore, CorporateCommand) you generally used code like:

<StaticData>
    <00182001_Donation>some data</00182001_Donation>
</StaticData>

But with newer stuff (NearStars / AncientRaces) it would be:

<StaticData>
    <Data id="00182001_Donation">some data</Data>
</StaticData>
nms 21 Jul 2017:

Even if there's a way to use this data id correctly, it's probably better to change it to one that doesn't risk encouraging people to use bad XML. But maybe the code that checks for it should also check the old id for old mod compatibility?

giantcabbage 21 Jul 2017:

I meant ALSO switch to using the id attibute method (I just copied&pasted the example from the PR which is why it has the old name).

I don't know if it make any difference to the engine, but George appears to have used the id method for EP and VotG...

0xabcdef 21 Jul 2017:

Actually, renaming all data entries to Data and using the id attribute is safer because the XML parser does not have to care as much about what's inside the attribute.

I believe that replacing custom-named elements with same-named elements that have an id attribute will prevent parsing errors.

I have updated the pull request to include.

nms 22 Jul 2017:

That's fine, but maybe the check in SistersOfDomina.xml should be

(setq entry (eval (or (itmGetStaticData theItem "SistersOfDominaDonation")
				(itmGetStaticData theItem "00182001_Donation")
			)
		)
	)

to avoid breaking old mods (whether they use bad XML or Data id=)?

george moromisato 4 Sep 2017:

I've made two changes in 1.8 Alpha 3:

  1. I've made the change suggested by @NMS to preserve backwards compatibility.
  2. In debug mode, we throw an error if an XML element has a bad name (but allow it in non-debug for compatibility).

Thank you!