# HG changeset patch # User IBBoard # Date 1253735901 0 # Node ID 0b32cc40d82fb4f1f912789a73d1fd9449f2fc5e # Parent 57517f472ab5acdd91d6b775ae6b60f8404c4221 Re #152: Test and fix extensibility of current schemas * Add extensibility to Race schema Also: * Code tidy for WarFoundryXmlFactoryUtils diff -r 57517f472ab5 -r 0b32cc40d82f api/Factories/Xml/WarFoundryXmlFactoryUtils.cs --- a/api/Factories/Xml/WarFoundryXmlFactoryUtils.cs Mon Sep 21 19:20:42 2009 +0000 +++ b/api/Factories/Xml/WarFoundryXmlFactoryUtils.cs Wed Sep 23 19:58:21 2009 +0000 @@ -16,6 +16,7 @@ /// public class WarFoundryXmlFactoryUtils { + public static readonly string NS_BASE = "http://ibboard.co.uk/warfoundry/"; private static XmlReaderSettings settings; private static XmlNamespaceManager nsManager; @@ -40,11 +41,11 @@ if (nsManager == null) { nsManager = new XmlNamespaceManager(new NameTable()); - nsManager.AddNamespace("core", "http://ibboard.co.uk/warfoundry/core"); - nsManager.AddNamespace("cat", "http://ibboard.co.uk/warfoundry/cats"); - nsManager.AddNamespace("race", "http://ibboard.co.uk/warfoundry/race"); - nsManager.AddNamespace("system", "http://ibboard.co.uk/warfoundry/system"); - nsManager.AddNamespace("army", "http://ibboard.co.uk/warfoundry/army"); + nsManager.AddNamespace("core", NS_BASE + "core"); + nsManager.AddNamespace("cat", NS_BASE + "cats"); + nsManager.AddNamespace("race", NS_BASE + "race"); + nsManager.AddNamespace("system", NS_BASE + "system"); + nsManager.AddNamespace("army", NS_BASE + "army"); } return nsManager; @@ -67,12 +68,11 @@ settings.ValidationEventHandler+= new ValidationEventHandler(ValidationEventMethod); XmlSchemaSet cache = new XmlSchemaSet(); string path = IBBoard.Constants.ExecutablePath + "/dtds/"; - string nsBase = "http://ibboard.co.uk/warfoundry/"; - AddSchemaToCache(cache, nsBase + "core", path + "warfoundry-core.xsd"); - AddSchemaToCache(cache, nsBase + "cats", path + "warfoundry-cats.xsd"); - AddSchemaToCache(cache, nsBase + "race", path + "race.xsd"); - AddSchemaToCache(cache, nsBase + "system", path + "system.xsd"); - AddSchemaToCache(cache, nsBase + "army", path + "army.xsd"); + AddSchemaToCache(cache, NS_BASE + "core", path + "warfoundry-core.xsd"); + AddSchemaToCache(cache, NS_BASE + "cats", path + "warfoundry-cats.xsd"); + AddSchemaToCache(cache, NS_BASE + "race", path + "race.xsd"); + AddSchemaToCache(cache, NS_BASE + "system", path + "system.xsd"); + AddSchemaToCache(cache, NS_BASE + "army", path + "army.xsd"); settings.Schemas.Add(cache); } @@ -81,7 +81,7 @@ private static void ValidationEventMethod(object sender, ValidationEventArgs e) { - throw new InvalidDataException("Problem validating against schema for WarFoundry data: " + e.Exception.Message, e.Exception); + throw new InvalidDataException("Problem validating against schema for WarFoundry data: " + e.Message, e.Exception); } private static void AddSchemaToCache(XmlSchemaSet cache, string xmlNamespace, string schemaLocation) diff -r 57517f472ab5 -r 0b32cc40d82f dtds/race.xsd --- a/dtds/race.xsd Mon Sep 21 19:20:42 2009 +0000 +++ b/dtds/race.xsd Wed Sep 23 19:58:21 2009 +0000 @@ -18,11 +18,13 @@ + + @@ -40,9 +42,11 @@ + + @@ -52,9 +56,11 @@ + + @@ -65,11 +71,13 @@ + + @@ -78,9 +86,11 @@ + + @@ -91,11 +101,13 @@ + + @@ -110,6 +122,7 @@ + @@ -128,9 +141,11 @@ + + @@ -143,9 +158,11 @@ + + @@ -153,6 +170,7 @@ +