changeset 272:166d01079acf

Re #290: Migrate to using key/keyref definitions instead of ID/IDREF type * Make extraData use local keys instead of global IDs * Change army to using a string, since we don't care what it is Also: * Implement loading of extra data so we can test it is loaded
author IBBoard <dev@ibboard.co.uk>
date Sat, 19 Jun 2010 15:50:05 +0000
parents da286069b9c6
children 3157ac054461
files api/Factories/Xml/WarFoundryXmlRaceFactory.cs schemas/race.xsd
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Mon Jun 14 19:56:10 2010 +0000
+++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sat Jun 19 15:50:05 2010 +0000
@@ -376,6 +376,12 @@
 		
 		private void LoadExtraDataForUnitType(XmlElement elem, UnitType type)
 		{
+			foreach (XmlElement extraData in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:extraData/race:data"))
+			{
+				string id = extraData.GetAttribute("id");
+				string data = extraData.InnerXml;
+				type.AddExtraData(id, data);
+			}
 		}
 		
 		private void LoadNotesForUnitType(XmlElement elem, UnitType type)
--- a/schemas/race.xsd	Mon Jun 14 19:56:10 2010 +0000
+++ b/schemas/race.xsd	Sat Jun 19 15:50:05 2010 +0000
@@ -59,7 +59,7 @@
 			</xs:element>
 			<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
 		</xs:sequence>
-		<xs:attribute name="id" type="xs:ID" />
+		<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="system" type="xs:string" use="required"/>
@@ -211,6 +211,10 @@
 				</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>