view schemas/race.xsd @ 310:f7c3c1b39726

Re #99: Define "points" values in GameSystem * Inline some local variables for readability * Define defaults in schema no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sun, 20 Feb 2011 20:36:48 +0000
parents cd657faa0c05
children 8cfb1818823d
line wrap: on
line source

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:core="http://ibboard.co.uk/warfoundry/core" xmlns:cats="http://ibboard.co.uk/warfoundry/cats"
targetNamespace="http://ibboard.co.uk/warfoundry/race" xmlns="http://ibboard.co.uk/warfoundry/race" xmlns:race="http://ibboard.co.uk/warfoundry/race" elementFormDefault="qualified">
<xs:element name="race">
	<xs:complexType>
		<xs:sequence>
			<xs:element name="categories" type="cats:categoriestype" minOccurs="0">
				<xs:key name="catsKey">
					<xs:selector xpath="cats:cat"/>
					<xs:field xpath="@id"/>
				</xs:key>
			</xs:element>
			<xs:element name="units">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="unit" maxOccurs="unbounded" type="unit">
							<xs:keyref name="equipSlotRef" refer="equipSlotKey">
								<xs:selector xpath="race:unitEquipment/race:unitEquipmentItem"/>
								<xs:field xpath="@equipmentSlot"/>
							</xs:keyref>
							<xs:key name="equipSlotKey">
								<xs:selector xpath="race:equipmentSlots/race:equipmentSlot"/>
								<xs:field xpath="@name"/>
							</xs:key>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="equipment" minOccurs="0" type="equipment">
			</xs:element>
			<xs:element name="abilities" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="ability" maxOccurs="unbounded">
							<xs:complexType>
								<xs:sequence>
									<xs:element name="description" type="xs:string" />
									<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
								</xs:sequence>
								<xs:attribute name="id" type="xs:string" use="required"/>
								<xs:attribute name="name" type="xs:string" use="required"/>
								<xs:anyAttribute processContents="lax"/>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
					<xs:anyAttribute processContents="lax"/>
				</xs:complexType>
			</xs:element>
			<xs:element name="memberTypes" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="memberType" maxOccurs="unbounded">
							<xs:complexType>
								<xs:sequence>
									<xs:element name="stats" type="stats" minOccurs="0"/>
								</xs:sequence>
								<xs:attribute name="id" type="xs:string" use="required"/>
								<xs:attribute name="name" type="xs:string" use="required"/>
								<xs:anyAttribute processContents="lax"/>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
		</xs:sequence>
		<xs:attribute name="id" type="xs:string" use="required" />
		<xs:attribute name="subid" type="xs:string" default=""/>
		<xs:attribute name="name" type="xs:string" use="required"/>
		<xs:attribute name="defaultArmyName" type="xs:string" default="" />
		<xs:attribute name="system" type="xs:string" use="required"/>
		<xs:anyAttribute processContents="lax"/>
	</xs:complexType>
	<xs:keyref name="memberTypeRef" refer="memberTypeKey">
		<xs:selector xpath="race:units/race:unit/race:unitMembers/race:unitMember"/>
		<xs:field xpath="@typeID"/>
	</xs:keyref>
	<xs:key name="memberTypeKey">
		<xs:selector xpath="race:memberTypes/race:memberType"/>
		<xs:field xpath="@id"/>
	</xs:key>
	<xs:keyref name="abilityRef" refer="abilityKey">
		<xs:selector xpath="race:units/race:unit/race:unitAbilities/race:unitAbility"/>
		<xs:field xpath="@abilityID"/>
	</xs:keyref>
	<xs:key name="abilityKey">
		<xs:selector xpath="race:abilities/race:ability"/>
		<xs:field xpath="@id"/>
	</xs:key>
	<xs:keyref name="equipmentItemRef" refer="equipmentItemKey">
		<xs:selector xpath="race:units/race:unit/race:unitEquipment/race:unitEquipmentItem"/>
		<xs:field xpath="@id"/>
	</xs:keyref>
	<xs:key name="equipmentItemKey">
		<xs:selector xpath="race:equipment/race:equipmentItem"/>
		<xs:field xpath="@id"/>
	</xs:key>
	<xs:keyref name="containedUnitRef" refer="unitKey">
		<xs:selector xpath="race:units/race:unit/race:contains/race:containedUnit"/>
		<xs:field xpath="@containedID"/>
	</xs:keyref>
	<xs:key name="unitKey">
		<xs:selector xpath="race:units/race:unit"/>
		<xs:field xpath="@id"/>
	</xs:key>
</xs:element>

<!--Reusable complex types -->
<xs:complexType name="unit">
	<xs:sequence>
		<xs:element name="stats" type="stats" minOccurs="0"/>
		<xs:element name="equipmentSlots" minOccurs="0">
			<xs:complexType>
				<xs:sequence>
					<xs:element name="equipmentSlot" maxOccurs="unbounded">
						<xs:complexType>
							<xs:sequence>
								<xs:element name="maxLimit" type="core:limit" />
								<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
							</xs:sequence>
							<xs:attribute name="name" type="xs:string" use="required"/>
							<xs:anyAttribute processContents="lax"/>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
			</xs:complexType>
		</xs:element>
		<xs:element name="unitEquipment" minOccurs="0">
			<xs:complexType>
				<xs:sequence>
					<xs:element name="unitEquipmentItem" maxOccurs="unbounded">
						<xs:complexType>
							<xs:sequence>
								<xs:element name="minLimit" minOccurs="0" type="core:limit" />
								<xs:element name="maxLimit" minOccurs="0" type="core:limit" />
								<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
							</xs:sequence>
							<xs:attribute name="id" type="xs:string" use="required" />
							<xs:attribute name="required" type="xs:boolean" default="false"/>
							<!-- exclusivityGroup is deprecated in favour of the comma-separated exclusivityGroups -->
							<xs:attribute name="exclusivityGroup" type="xs:string" default=""/>
							<xs:attribute name="exclusivityGroups" type="xs:string" default=""/>
							<xs:attribute name="equipmentSlot" type="xs:string"/>
							<xs:attribute name="roundDirection" type="core:updowntype" default="up"/>
							<xs:attribute name="costMultiplier" type="core:nonNegativeDouble" default="1"/>
							<xs:attribute name="costRounding" type="costroundingtype" default="UpToHalf"/>
							<xs:anyAttribute processContents="lax"/>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
				<xs:anyAttribute processContents="lax"/>
			</xs:complexType>
		</xs:element>
		<xs:element name="unitAbilities" minOccurs="0">
			<xs:complexType>
				<xs:sequence>
					<xs:element name="unitAbility" maxOccurs="unbounded">
						<xs:complexType>
							<xs:sequence>
								<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
							</xs:sequence>
							<xs:attribute name="abilityID" type="xs:string" />
							<xs:attribute name="required" type="xs:boolean" default="true"/>
							<xs:anyAttribute processContents="lax"/>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
				<xs:anyAttribute processContents="lax"/>
			</xs:complexType>
		</xs:element>
		<xs:element name="requirements" minOccurs="0">
			<xs:complexType>
				<xs:sequence>
					<xs:element name="requirement">
						<xs:complexType>
							<xs:simpleContent>
								<xs:extension base="xs:string">
									<xs:attribute name="requirementName" type="xs:string" use="required"/>
									<xs:anyAttribute processContents="lax"/>
								</xs:extension>
							</xs:simpleContent>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
				<xs:anyAttribute processContents="lax"/>
			</xs:complexType>
		</xs:element>
		<xs:element name="contains" minOccurs="0">
			<xs:complexType>
				<xs:sequence>
					<xs:element name="containedUnit" maxOccurs="unbounded">
						<xs:complexType>
							<xs:sequence>
								<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
							</xs:sequence>
							<xs:attribute name="containedID" type="xs:string" use="required"/>
							<xs:anyAttribute processContents="lax"/>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
				<xs:anyAttribute processContents="lax"/>
			</xs:complexType>
		</xs:element>
		<xs:element name="extraData" minOccurs="0">
			<xs:complexType>
				<xs:sequence>
					<xs:element name="data" maxOccurs="unbounded">
						<xs:complexType>
							<xs:simpleContent>
								<xs:extension base="xs:string">
									<xs:attribute name="id" type="xs:string" use="required"/>
									<xs:anyAttribute processContents="lax"/>
								</xs:extension>
							</xs:simpleContent>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
				<xs:anyAttribute processContents="lax"/>
			</xs:complexType>
			<xs:key name="extraDataKey">
				<xs:selector xpath="race:data"/>
				<xs:field xpath="@id"/>
			</xs:key>
		</xs:element>
		<xs:element name="unitMembers" minOccurs="0">
			<xs:complexType>
				<xs:sequence>
					<xs:element name="unitMember" maxOccurs="unbounded">
						<xs:complexType>
							<xs:sequence>
								<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
							</xs:sequence>
							<xs:attribute name="typeID" type="xs:string" use="required"/>
							<xs:anyAttribute processContents="lax"/>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
			</xs:complexType>
		</xs:element>
		<xs:element name="unitCategories" minOccurs="0">
			<xs:complexType>
				<xs:sequence>
					<xs:element name="unitCategory" maxOccurs="unbounded">
						<xs:complexType>
							<xs:sequence>
								<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
							</xs:sequence>
							<xs:attribute name="catID" type="xs:string" use="required"/>
							<xs:anyAttribute processContents="lax"/>
						</xs:complexType>
					</xs:element>
				</xs:sequence>
			</xs:complexType>
		</xs:element>
		<xs:element name="notes" type="xs:string" minOccurs="0" />
		<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
	</xs:sequence>
	<xs:attribute name="id" type="xs:string" use="required" />
	<xs:attribute name="typeName" type="xs:string" use="required"/>
	<xs:attribute name="cat" type="xs:string" use="required"/>
	<xs:attribute name="points" type="core:nonNegativeNonInfiniteDouble" use="required"/>
	<xs:attribute name="basePoints" type="core:nonNegativeNonInfiniteDouble" default="0"/>
	<xs:attribute name="baseSize" type="xs:nonNegativeInteger" default="0"/>
	<xs:attribute name="minSize" type="xs:nonNegativeInteger" default="5"/>
	<xs:attribute name="maxSize" type="core:positiveOrInfiniteInteger" default="-1"/>
	<xs:attribute name="minNum" type="xs:nonNegativeInteger" default="0"/>
	<xs:attribute name="maxNum" type="core:positiveOrInfiniteInteger" default="-1"/>
	<xs:anyAttribute processContents="lax"/>
</xs:complexType>

<xs:complexType name="stats">
	<xs:sequence>
		<xs:element name="stat" maxOccurs="unbounded">
			<xs:complexType>
				<xs:simpleContent>
					<xs:extension base="xs:string">
						<xs:attribute name="name" type="xs:string" use="required"/>
						<xs:anyAttribute processContents="lax"/>
					</xs:extension>
				</xs:simpleContent>
			</xs:complexType>
		</xs:element>
	</xs:sequence>
	<xs:attribute name="statSet" type="xs:string" default="" />
	<xs:anyAttribute processContents="lax"/>
</xs:complexType>

<xs:complexType name="equipment">
	<xs:sequence>
		<xs:element name="equipmentItem" maxOccurs="unbounded">
			<xs:complexType>
				<xs:sequence>
					<xs:element name="description" type="xs:string" minOccurs="0" />
					<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
				</xs:sequence>
				<xs:attribute name="id" type="xs:string" use="required"/>
				<xs:attribute name="name" type="xs:string" use="required"/>
				<xs:attribute name="cost" type="core:nonNegativeNonInfiniteDouble" use="required"/>
				<xs:anyAttribute processContents="lax"/>
			</xs:complexType>
		</xs:element>
	</xs:sequence>
	<xs:anyAttribute processContents="lax"/>
</xs:complexType>

<!--Reusable simple types -->
<xs:simpleType name="costroundingtype">
	<xs:restriction base="xs:string">
		<xs:enumeration value="Up"/>
		<xs:enumeration value="Down"/>
		<xs:enumeration value="Banker"/>
		<xs:enumeration value="UpToHalf"/>
		<xs:enumeration value="DownToHalf"/>
		<xs:enumeration value="BankerToHalf"/>
	</xs:restriction>
</xs:simpleType>
</xs:schema>