diff schemas/race.xsd @ 267:3f14a792fd41

Re #274: Crash when missing unit member ID * Add key and keyref for member type Re #290: Migrate to using key/keyref definitions instead of ID/IDREF type * Move keyref and key for equipment slot to correct place to be valid * Add aliased xmlns for schema to allow for use in XPath, which doesn't use default namespace * Disable warning reporting until Mono Bug 613684 is fixed (https://bugzilla.novell.com/show_bug.cgi?id=613684)
author IBBoard <dev@ibboard.co.uk>
date Sat, 12 Jun 2010 19:49:32 +0000
parents 7933d852181e
children 51d7b2b26882
line wrap: on
line diff
--- a/schemas/race.xsd	Sat Jun 05 18:57:46 2010 +0000
+++ b/schemas/race.xsd	Sat Jun 12 19:49:32 2010 +0000
@@ -1,6 +1,6 @@
 <?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" elementFormDefault="qualified">
+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>
@@ -8,7 +8,16 @@
 			<xs:element name="units">
 				<xs:complexType>
 					<xs:sequence>
-						<xs:element name="unit" maxOccurs="unbounded" type="unit"/>
+						<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>
@@ -60,6 +69,14 @@
 		<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:element>
 
 <!--Reusable complex types -->
@@ -81,10 +98,6 @@
 					</xs:element>
 				</xs:sequence>
 			</xs:complexType>
-			<xs:key name="equipSlotName">
-				<xs:selector xpath="equipmentSlot"/>
-				<xs:field xpath="@name"/>
-			</xs:key>
 		</xs:element>
 		<xs:element name="unitEquipment" minOccurs="0">
 			<xs:complexType>
@@ -107,10 +120,6 @@
 							<xs:attribute name="costRounding" type="costroundingtype" default="UpToHalf"/>
 							<xs:anyAttribute processContents="lax"/>
 						</xs:complexType>
-						<xs:keyref name="equipmentSlot" refer="equipSlotName">
-							<xs:selector xpath="."/>
-							<xs:field xpath="@equipmentSlot"/>
-						</xs:keyref>
 					</xs:element>
 				</xs:sequence>
 				<xs:anyAttribute processContents="lax"/>