client/src/Iri.Modernisation.Data/Ldt/LDTFile.cs
changeset 35 43bb1b8ed555
parent 34 4d9ebc6fbbe8
child 38 bd33267300aa
--- a/client/src/Iri.Modernisation.Data/Ldt/LDTFile.cs	Tue Jan 19 09:49:56 2010 +0100
+++ b/client/src/Iri.Modernisation.Data/Ldt/LDTFile.cs	Mon Jan 25 09:30:22 2010 +0100
@@ -98,6 +98,40 @@
                 }
             }
         }
+        static public LDTFile FromXML(XDocument xdoc)
+        {
+            LDTFile returnFile = new LDTFile();
+            returnFile.Project = new LDTProject(xdoc.Root.Element("project"));
+            foreach (XElement Elem in xdoc.Root.Element("medias").Elements())
+            {
+                returnFile.Medias.Add(new LDTMedia(Elem));
+            }
+
+            foreach (XElement Elem in xdoc.Root.Element("annotations").Elements())
+            {
+                returnFile.Annotations.Add(new LDTAnnotationsContent(Elem));
+            }
+
+            foreach (XElement Elem in xdoc.Root.Element("displays").Elements())
+            {
+               returnFile.Displays.Add(new LDTDisplay(Elem));
+            }
+
+            foreach (XElement Elem in xdoc.Root.Element("edits").Elements())
+            {
+                returnFile.Edits.Add(new LDTEditing(Elem));
+            }
+
+            if (xdoc.Root.Element("realtions") != null)
+            {
+                foreach (XElement Elem in xdoc.Root.Element("realtions").Elements())
+                {
+                    returnFile.Relations.Add(new LDTRelation(Elem));
+                }
+            }
+            return returnFile;
+        }
+
         public XDocument XMLFile
         {
             get