void TestR5() { "Demonstrating Requirement #5".title(); DBElement<int, string> elem2 = new DBElement<int, string>(); elem2.name = "element#2";//add a new key/value pairs elem2.descr = "test element#2"; elem2.timeStamp = DateTime.Now; elem2.children.AddRange(new List<int>{ 16, 48 }); elem2.payload = "elem#2's payload"; db.insert(7, elem2); PersistToXML toxml = new PersistToXML(db); toxml.writeXML("Test.xml"); toxml.displayXML(); toxml.cleanDB(); Write("\n --- Test read XML file Start---"); LoadXML fromxml = new LoadXML(db, "ReadFile.xml"); fromxml.WriteToDBEngine(); Write("\n\n Show key/value pairs in data base:\n"); db.showDB(); Write("\n --- Test read XML file End---"); WriteLine(); }
public void recoverDB(XDocument message){//method used to recover a db from a xml file XElement element = message.Element("Message").Element("File"); LoadXML fromxml = new LoadXML(db, element.Value); fromxml.WriteToDBEngine(); }