Mercurial > repos > snowblizz-super-API-ideas
changeset 31:457c9357dd64
Re #32 - Convert to schemas
* Remove node count check from factory - Schema should validate document properly
* Update race schema:
* Add min and maxOccurs attributes
* change "points" to "cost"
* change equipID to ID
* temporarily replace core:nonNegativeDecimal with xs:integer so that we don't get stuck on validation errors about casting to string
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 14 Mar 2009 20:38:16 +0000 |
parents | 92cf25b0493b |
children | 6b9d37f14a14 |
files | api/Factories/Xml/WarFoundryXmlFactory.cs dtds/race.xsd |
diffstat | 2 files changed, 16 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlFactory.cs Sat Mar 14 20:16:09 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlFactory.cs Sat Mar 14 20:38:16 2009 +0000 @@ -277,11 +277,6 @@ finally { reader.Close(); - } - - if (doc.ChildNodes.Count!=3) - { - throw new InvalidFileException(Translation.GetTranslation("ErrorInvalidXmlFile", "XML file was not a valid XML file. It should contain three child nodes - XML definition, DocType and root node.")); } return doc;
--- a/dtds/race.xsd Sat Mar 14 20:16:09 2009 +0000 +++ b/dtds/race.xsd Sat Mar 14 20:38:16 2009 +0000 @@ -5,9 +5,9 @@ <xs:complexType> <xs:all> <xs:element name="units" type="unitstype" minOccurs="1"/> - <xs:element name="categories" type="cats:categoriestype" /> - <xs:element name="equipment" type="equipmenttype" /> - <xs:element name="abilities" type="abilitiestype" /> + <xs:element name="categories" type="cats:categoriestype" minOccurs="0" /> + <xs:element name="equipment" type="equipmenttype" minOccurs="0" /> + <xs:element name="abilities" type="abilitiestype" minOccurs="0" /> </xs:all> <xs:attribute name="id" type="xs:ID" /> <xs:attribute name="subid" type="xs:string" default=""/> @@ -24,11 +24,11 @@ <xs:all> <xs:element name="stats" type="statstype" minOccurs="1" /> <xs:element name="unitEquipment" type="unitequipmenttype" /> - <xs:element name="unitAbilities" type="unitabilitiestype" /> - <xs:element name="requirements" type="requirementstype" /> - <xs:element name="contains" type="containstype" /> - <xs:element name="extraData" type="extradatatype" /> - <xs:element name="notes" type="xs:string" /> + <xs:element name="unitAbilities" type="unitabilitiestype" minOccurs="0" /> + <xs:element name="requirements" type="requirementstype" minOccurs="0" /> + <xs:element name="contains" type="containstype" minOccurs="0" /> + <xs:element name="extraData" type="extradatatype" minOccurs="0" /> + <xs:element name="notes" type="xs:string" minOccurs="0" /> </xs:all> <xs:attribute name="id" type="xs:ID" /> <xs:attribute name="typeName" type="xs:string" use="required"/> @@ -36,9 +36,9 @@ <xs:attribute name="unitPoints" type="core:nonNegativeDecimal" default="0"/> <xs:attribute name="points" type="core:nonNegativeDecimal" use="required"/> <xs:attribute name="minNum" type="xs:nonNegativeInteger" default="0"/> - <xs:attribute name="maxNum" type="core:infiniteOrNonNegativeInteger" default="-1"/> + <xs:attribute name="maxNum" type="xs:integer" default="-1"/> <xs:attribute name="minSize" type="xs:positiveInteger" default="5"/> - <xs:attribute name="maxSize" type="core:infiniteOrNonNegativeInteger" default="-1"/> + <xs:attribute name="maxSize" type="xs:integer" default="-1"/> <xs:attribute name="baseSize" type="xs:nonNegativeInteger" default="0"/> </xs:complexType> <xs:complexType name="statstype"> @@ -59,11 +59,11 @@ </xs:sequence> </xs:complexType> <xs:complexType name="unitequipmentitemtype"> - <xs:attribute name="equipID" type="xs:IDREF" /> + <xs:attribute name="id" type="xs:IDREF" /> <xs:attribute name="required" type="xs:boolean" default="false"/> <xs:attribute name="exclusivityGroup" type="xs:string" default=""/> - <xs:attribute name="minNum" type="core:infiniteOrNonNegativeInteger" default="-1"/> - <xs:attribute name="maxNum" type="core:infiniteOrNonNegativeInteger" default="-1"/> + <xs:attribute name="minNum" type="xs:integer" default="-1"/> + <xs:attribute name="maxNum" type="xs:integer" default="-1"/> <xs:attribute name="minPercentage" type="core:percentage" default="100"/> <xs:attribute name="maxPercentage" type="core:percentage" default="100"/> <xs:attribute name="roundDirection" type="updowntype" default="up"/> @@ -117,16 +117,16 @@ </xs:complexType> <xs:complexType name="equipmenttype"> <xs:sequence> - <xs:element name="equipmentItem" type="equipmentitemtype"/> + <xs:element name="equipmentItem" type="equipmentitemtype" maxOccurs="unbounded" /> </xs:sequence> </xs:complexType> <xs:complexType name="equipmentitemtype"> <xs:all> - <xs:element name="description" type="xs:string" /> + <xs:element name="description" type="xs:string" minOccurs="0" /> </xs:all> <xs:attribute name="id" type="xs:ID" use="required"/> <xs:attribute name="name" type="xs:string" use="required"/> - <xs:attribute name="points" type="core:nonNegativeDecimal" use="required"/> + <xs:attribute name="cost" type="core:nonNegativeDecimal" use="required"/> <xs:attribute name="armoutType" type="armourtype" default="none"/> </xs:complexType> <xs:simpleType name="armourtype">