// Export Equipment Data to XML File public static void StoreNewXMLData(ref MainClass.XMLDocData doc, Equipment AddMe) { XmlDocument xml = new XmlDocument (); xml = DatatoXML (ref AddMe); doc.XMLDoc.DocumentElement.AppendChild (xml.SelectSingleNode ("unit")); XMLSave (ref doc.XMLDoc); }
// Trasfer Equipment class data to XMLNode private static XmlDocument DatatoXML(ref Equipment unit) { EquipmentXML template = new EquipmentXML (); XmlDocument AddMe = template.doc; //Set Attributes AddMe.DocumentElement.SetAttribute ("ID", unit.ID); AddMe.DocumentElement.SetAttribute ("Type", unit.Type); AddMe.DocumentElement.SetAttribute ("Group", unit.Group); //Set Child Elements AddMe.DocumentElement.SelectSingleNode("contents").InnerText = unit.Contents; AddMe.DocumentElement.SelectSingleNode ("length").InnerText = unit.Length; AddMe.DocumentElement.SelectSingleNode ("width").InnerText = unit.Width; AddMe.DocumentElement.SelectSingleNode ("height").InnerText = unit.Height; AddMe.DocumentElement.SelectSingleNode ("weight").InnerText = unit.Weight; AddMe.DocumentElement.SelectSingleNode ("consumables").InnerText = unit.Consumables; AddMe.DocumentElement.SelectSingleNode ("companions").InnerText = unit.Companions; AddMe.DocumentElement.SelectSingleNode ("notes").InnerText = unit.Notes; AddMe.DocumentElement.SelectSingleNode ("shoplocation").InnerText = unit.Shoplocation; return AddMe; }
public EquipmentNode() { // next = new EquipmentNode (); unit = new Equipment (); }