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 diff
     1.1 --- a/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Mon Jun 14 19:56:10 2010 +0000
     1.2 +++ b/api/Factories/Xml/WarFoundryXmlRaceFactory.cs	Sat Jun 19 15:50:05 2010 +0000
     1.3 @@ -376,6 +376,12 @@
     1.4  		
     1.5  		private void LoadExtraDataForUnitType(XmlElement elem, UnitType type)
     1.6  		{
     1.7 +			foreach (XmlElement extraData in WarFoundryXmlFactoryUtils.SelectNodes(elem, "race:extraData/race:data"))
     1.8 +			{
     1.9 +				string id = extraData.GetAttribute("id");
    1.10 +				string data = extraData.InnerXml;
    1.11 +				type.AddExtraData(id, data);
    1.12 +			}
    1.13  		}
    1.14  		
    1.15  		private void LoadNotesForUnitType(XmlElement elem, UnitType type)
     2.1 --- a/schemas/race.xsd	Mon Jun 14 19:56:10 2010 +0000
     2.2 +++ b/schemas/race.xsd	Sat Jun 19 15:50:05 2010 +0000
     2.3 @@ -59,7 +59,7 @@
     2.4  			</xs:element>
     2.5  			<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
     2.6  		</xs:sequence>
     2.7 -		<xs:attribute name="id" type="xs:ID" />
     2.8 +		<xs:attribute name="id" type="xs:string" use="required" />
     2.9  		<xs:attribute name="subid" type="xs:string" default=""/>
    2.10  		<xs:attribute name="name" type="xs:string" use="required"/>
    2.11  		<xs:attribute name="system" type="xs:string" use="required"/>
    2.12 @@ -211,6 +211,10 @@
    2.13  				</xs:sequence>
    2.14  				<xs:anyAttribute processContents="lax"/>
    2.15  			</xs:complexType>
    2.16 +			<xs:key name="extraDataKey">
    2.17 +				<xs:selector xpath="race:data"/>
    2.18 +				<xs:field xpath="@id"/>
    2.19 +			</xs:key>	
    2.20  		</xs:element>
    2.21  		<xs:element name="unitMembers" minOccurs="0">
    2.22  			<xs:complexType>