annotate API/Savers/Xml/WarFoundryXmlArmySaver.cs @ 402:cf8fc32e020a xsl-output

preliminary xsl output
author Dan.Kulinski@dank-laptop.Global.Local
date Thu, 18 Aug 2011 11:14:14 -0600
parents 3c4a6403a88c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
337
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (WarFoundryXmlSaver.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 IBBoard.
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using System.Collections.Generic;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 using System.IO;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 using System.Xml;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 using System.Xml.Schema;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 using IBBoard.Lang;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 using IBBoard.Xml;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 using IBBoard.WarFoundry.API.Factories.Xml.Zip;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 using IBBoard.WarFoundry.API.Objects;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 using IBBoard.WarFoundry.API.Savers;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15 using IBBoard.WarFoundry.API.Util;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 using ICSharpCode.SharpZipLib.Zip;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 namespace IBBoard.WarFoundry.API.Savers.Xml
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20 public class WarFoundryXmlArmySaver
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 public string CreateXmlString(Army toSave)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 XmlDocument doc = new XmlDocument();
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 XmlDeclaration declaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 doc.AppendChild(declaration);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 XmlSchema schema = new XmlSchema();
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28 schema.Namespaces.Add("", "http://ibboard.co.uk/warfoundry/army");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
29 schema.Namespaces.Add("core", "http://ibboard.co.uk/warfoundry/core");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
30 doc.Schemas.Add(schema);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
31 XmlElement root = doc.CreateElement("army");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
32 root.SetAttribute("xmlns", "http://ibboard.co.uk/warfoundry/army");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
33 root.SetAttribute("xmlns:core", "http://ibboard.co.uk/warfoundry/core");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
34 doc.AppendChild(root);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
35 root.SetAttribute("id", XmlTools.GetAsciiXmlIdForString(toSave.ID));
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
36 root.SetAttribute("name", toSave.Name);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 //Don't convert system and race to ID format as they could be stored in non-XML file formats
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 //If they are in XML files then they'll already be valid
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 root.SetAttribute("system", toSave.GameSystem.ID);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
40 root.SetAttribute("race", toSave.Race.ID);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 root.SetAttribute("maxPoints", toSave.MaxPoints.ToString());
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 XmlElement units = doc.CreateElement("units");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 root.AppendChild(units);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45 foreach (Unit unit in toSave.GetUnits())
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
46 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
47 units.AppendChild(CreateUnitElement(unit, doc));
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
48 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50 return doc.OuterXml;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
52
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 private XmlElement CreateUnitElement(Unit unit, XmlDocument doc)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
55 XmlElement unitElem = doc.CreateElement("unit");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
56 unitElem.SetAttribute("id", XmlTools.GetAsciiXmlIdForString(unit.ID));
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
57 unitElem.SetAttribute("unitName", (unit.HasDefaultName() ? "" : unit.Name));
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
58 unitElem.SetAttribute("unitType", unit.UnitType.ID);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
59 unitElem.SetAttribute("size", unit.Size.ToString());
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
60
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
61 if (!unit.Race.Equals(unit.Army.Race))
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
62 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
63 unitElem.SetAttribute("race", unit.Race.ID);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
64 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
65
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
66 Category unitCategory = unit.Category.Category;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
67 if (!unit.UnitType.MainCategory.Equals(unitCategory))
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
68 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
69 unitElem.SetAttribute("category", unitCategory.ID);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
70 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
71
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
72 XmlElement equipmentElem = CreateEquipmentItemsElement(unit, doc);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
73
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
74 if (equipmentElem != null)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
75 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
76 unitElem.AppendChild(equipmentElem);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
77 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
78
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
79 XmlElement containedElem = CreateContainedUnitsElement(unit, doc);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
80
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
81 if (containedElem != null)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
82 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
83 unitElem.AppendChild(containedElem);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
84 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
85
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
86 return unitElem;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
87 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
88
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
89 private XmlElement CreateEquipmentItemsElement(Unit unit, XmlDocument doc)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
90 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
91 UnitEquipmentItem[] equipItems = unit.GetEquipment();
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
92 int equipItemCount = equipItems.Length;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
93 XmlElement equipmentElem = null;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
94
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
95 if (equipItemCount > 0)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
96 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
97 equipmentElem = doc.CreateElement("equipment");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
98
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
99 for (int i = 0; i < equipItemCount; i++)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
100 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
101 equipmentElem.AppendChild(CreateEquipmentElement(equipItems[i], unit, doc));
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
102 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
103 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
104
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
105 return equipmentElem;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
106 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
107
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
108 private XmlElement CreateEquipmentElement(UnitEquipmentItem item, Unit unit, XmlDocument doc)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
109 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
110 XmlElement equipmentItemElem = doc.CreateElement("equipItem");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
111 equipmentItemElem.SetAttribute("id", item.ID);
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
112 equipmentItemElem.SetAttribute("amount", UnitEquipmentUtil.GetEquipmentAmount(unit, item).ToString());
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
113 equipmentItemElem.SetAttribute("amountType", UnitEquipmentUtil.GetEquipmentAmountIsRatio(unit, item) ? "ratio" : "fixed");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
114 return equipmentItemElem;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
115 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
116
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
117 private XmlElement CreateContainedUnitsElement(Unit unit, XmlDocument doc)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
118 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
119 Unit[] containedUnits = unit.ContainedUnits;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
120 int containedCount = containedUnits.Length;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
121 XmlElement containedElem = null;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
122
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
123 if (containedCount > 0)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
124 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
125 containedElem = doc.CreateElement("contained");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
126
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
127 for (int i = 0; i < containedCount; i++)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
128 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
129 containedElem.AppendChild(CreateContainedUnitElement(containedUnits[i], doc));
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
130 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
131 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
132
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
133 return containedElem;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
134 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
135
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
136 private XmlElement CreateContainedUnitElement(Unit unit, XmlDocument doc)
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
137 {
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
138 XmlElement containedUnitElem = doc.CreateElement("containedUnit");
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
139 containedUnitElem.SetAttribute("containedID", XmlTools.GetAsciiXmlIdForString(unit.ID));
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
140 return containedUnitElem;
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
141 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
142 }
3c4a6403a88c * Fix capitalisation so that new files are in the namespace
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
143 }