public static void LoadXMLdata(ref MainClass.XMLDocData doc, ref EquipmentListHeadandFoot list) { EquipmentNode cur = list.Head; //Assign Linked List Head EquipmentNode Next; //Object to hold new EquipmentNode object foreach (XmlNode node in doc.XMLDoc.DocumentElement.SelectNodes("unit")) { // Console.WriteLine (node.Name); Next = new EquipmentNode (); //Create new Node object //Iterate through XML file and import data to Linked List if ((node) != null) { cur.Next = Next; cur = cur.Next; cur.unit.ID = node.Attributes ["ID"].Value; cur.unit.Type = node.Attributes ["Type"].Value; cur.unit.Group = node.Attributes ["Group"].Value; cur.unit.Contents = node.SelectSingleNode ("contents").InnerText; cur.unit.Length = node.SelectSingleNode ("length").InnerText; cur.unit.Width = node.SelectSingleNode ("width").InnerText; cur.unit.Height = node.SelectSingleNode ("height").InnerText; cur.unit.Weight = node.SelectSingleNode ("weight").InnerText; cur.unit.Consumables = node.SelectSingleNode ("consumables").InnerText; cur.unit.Companions = node.SelectSingleNode ("companions").InnerText; cur.unit.Notes = node.SelectSingleNode ("notes").InnerText; cur.unit.Shoplocation = node.SelectSingleNode ("shoplocation").InnerText; list.Total++; } } }
// 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); }