Пример #1
0
        // 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;
        }
Пример #2
0
 //Save XMLDocument to file
 public static void XMLSave(ref XmlDocument doc)
 {
     EquipmentXML template = new EquipmentXML ();
     //			template.doc = doc;
     template.doc.Save ("/Users/ethandahlke/Desktop/Save_Test.xml");
 }