XML validation with xsd schema?

human machine

Chieftain
Joined
Jan 25, 2009
Messages
32
I've been doing a bunch of XML work on my mod, and I keep getting tripped up by numerous simple spelling errors.

After some googling, I've found that xml can be validated with .xsd schema
Does anyone around here use xsd to validate their mod xml files?

MS Visual Studio (and therefore ModBuddy) will create xsd files from xml. Using the Civ5 vanilla xml, I've created some xsd files, which after some editing and literature reading, will give me blue squiggly lines under misspelled elements in my xml files.

And I've figured out how to list possible values for named elements.
Without a schema applied my art style prefex: MED_awesome is ignored
(first screenshot), but when I add
Code:
<xs:element name="UnitAIType" type="UnitAIInfos"/>

<xs:simpleType name="ArtStyleSuffixInfos">
        <xs:restriction base="xs:string">
            <xs:enumeration value="_EURO"/>
            <xs:enumeration value="_AFRI"/>
            <xs:enumeration value="_AMER"/>
            <xs:enumeration value="_ASIA"/>
            <xs:enumeration value="_MED"/>
        </xs:restriction>
    </xs:simpleType>

to the xsd schema, I get the squiggly blue line (second screenshot)

I've started adding values for other elements (there are 93 building types!), but the developers must have made xsd files like these.

Are there any xsd files out there already?
or are there tools that would make these things automatically so I don't have write in all the values by hand?
ModBuddy1.png

ModBuddy2.png
 
I don't believe that they develop their stuff using XML. that is something they leave to the poor modders :sad:

you could supposedly go the way of xsd definitions for all the xml resources around. however, you will spend a LOT of time doing that. Basically you do everything twice:

- you add your additions to the xml
- you add your additions to the xsd

if you mainly stay with modifying existing stuff, those additions will not be necessary. to manually collect all the 'legal' values to compile the initial set of xsd files will be tiresome, to say the least...

I would refrain from going the xsd way manually, since you will have to update them with every addition continually.

There are ways to this programmatically.

I am currently thinking about writing an MDK (Mod Development Kit) that would certainly cover your requirements in providing safe editing of the game resources.

I have not, however, started with this project, as I believe it would mean quite a bit of work.

If the community welcomed such a tool, I might reconsider. In any way, for such an undertaking you would be looking at a few of months for the first release.
 
Back
Top Bottom