[messages] [Developers] Design of property and piece XML for V4

alitur juho.rutila at gmail.com
Fri Sep 14 02:18:01 MST 2012


"uckelman" wrote:
> 
> > Now the properties of the piece could be found under the properties
> tag.
> > Property name would be the element name. The validation that
> > movement_allowance should be int could be defined in
> > battleformoscow.xsd. But is this only leading us to the next step?
> 
> This prefents us from having a common schema for all modules. Creating
> a correct schema isn't easy, and having that will save us endless
> trouble from bad input. An incorrect schema means that we can't trust
> the integrity of the input we get. Few module designers will have ever
> heard of schmata, let alone be able to create ones which have no
> holes.
> 


Actually the common schema (vassal.xsd) would be common for all modules.
It only says that piece has to have some properties. That is common for
all the modules. The "extra" schema would be just for the game specific
properties. So instead of writing

Code:

<intProperty id="movement_allowance" minValue="0">5</intProperty>



where the property type and restrictions are in the tag, one could write
the metadata to a different file (game.xsd) and the actual value to
another (game.xml).

Code:

game.xsd
<xsd:element name="movement_allowance">
 <xsd:simpleType>
  <xsd:restriction base="xsd:int">
   <xsd:minExclusive value="0"/>
  </xsd:restriction>
 </xsd:simpleType>
</xsd:element>

game.xml
<movement_allowance>5</movement_allowance>




Okay, I have to admit the first one is easier to write. On the other
hand the latter xml file is easier to read and does not contain all the
metadata. The property definitions are also more reusable. Think of
writing many pieces with movement_allowance.
Also, are these files really written by hand? One can also write an xslt
that can do the transformation between those two formats.

_______________________________________________
Read this topic online here:
http://www.vassalengine.org/forum/viewtopic.php?p=36043#p36043


More information about the messages mailing list