Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/AtomicOperation.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/AtomicOperation.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/AtomicOperation.cs	(revision 125)
@@ -62,8 +62,16 @@
       PersistenceManager.Persist("Scope", Scope, writer, persistedObjects);
     }
-    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
-      base.Populate(node, restoredObjects);
-      myOperator = (IOperator)PersistenceManager.Restore(node.SelectSingleNode("Operator"), restoredObjects);
-      myScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("Scope"), restoredObjects);
+    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+    //  base.Populate(node, restoredObjects);
+    //  myOperator = (IOperator)PersistenceManager.Restore(node.SelectSingleNode("Operator"), restoredObjects);
+    //  myScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("Scope"), restoredObjects);
+    //}
+    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      base.Populate(reader, restoredObjects);
+      reader.Read();
+      myOperator = (IOperator)PersistenceManager.Restore(reader, "Operator", restoredObjects);
+      reader.Skip();
+      myScope = (IScope)PersistenceManager.Restore(reader, "Scope", restoredObjects);
+      reader.Read();
     }
     #endregion
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/CompositeOperation.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/CompositeOperation.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/CompositeOperation.cs	(revision 125)
@@ -79,12 +79,28 @@
       writer.WriteEndElement(); // </Operations>
     }
-    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
-      base.Populate(node, restoredObjects);
+    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+    //  base.Populate(node, restoredObjects);
 
-      myExecuteInParallel = bool.Parse(node.Attributes["ExecuteInParallel"].Value);
+    //  myExecuteInParallel = bool.Parse(node.Attributes["ExecuteInParallel"].Value);
 
-      XmlNode operationsNode = node.SelectSingleNode("Operations");
-      for (int i = 0; i < operationsNode.ChildNodes.Count; i++)
-        AddOperation((IOperation)PersistenceManager.Restore(operationsNode.ChildNodes[i], restoredObjects));
+    //  XmlNode operationsNode = node.SelectSingleNode("Operations");
+    //  for (int i = 0; i < operationsNode.ChildNodes.Count; i++)
+    //    AddOperation((IOperation)PersistenceManager.Restore(operationsNode.ChildNodes[i], restoredObjects));
+    //}
+    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      myExecuteInParallel = bool.Parse(reader["ExecuteInParallel"]);
+      base.Populate(reader, restoredObjects);
+
+      if(reader.Name != "Operations") throw new XmlException("Expected: \"Operations\", found: \""+reader.Name+"\"");
+      if(!reader.IsEmptyElement) {
+        reader.Read();
+        while(reader.IsStartElement()) {
+          AddOperation((IOperation)PersistenceManager.Restore(reader, restoredObjects));
+          reader.Skip();
+        }
+        reader.ReadEndElement();
+      } else {
+        reader.Read();
+      }
     }
     #endregion
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/ConstrainedItemBase.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/ConstrainedItemBase.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/ConstrainedItemBase.cs	(revision 125)
@@ -39,5 +39,5 @@
       ConstrainedItemBase clone = (ConstrainedItemBase)base.Clone(clonedObjects);
       clone.myConstraints.Clear();
-      foreach (IConstraint constraint in Constraints)
+      foreach(IConstraint constraint in Constraints)
         clone.AddConstraint((IConstraint)Auxiliary.Clone(constraint, clonedObjects));
       return clone;
@@ -49,5 +49,5 @@
     }
     public virtual void RemoveConstraint(IConstraint constraint) {
-      if (myConstraints.Remove(constraint))
+      if(myConstraints.Remove(constraint))
         OnConstraintRemoved(constraint);
     }
@@ -55,5 +55,5 @@
     public bool IsValid() {
       bool result = true;
-      foreach (IConstraint constraint in Constraints)
+      foreach(IConstraint constraint in Constraints)
         result = result && constraint.Check(this);
       return result;
@@ -62,6 +62,6 @@
       bool result = true;
       violatedConstraints = new List<IConstraint>();
-      foreach (IConstraint constraint in Constraints) {
-        if (!constraint.Check(this)) {
+      foreach(IConstraint constraint in Constraints) {
+        if(!constraint.Check(this)) {
           result = false;
           violatedConstraints.Add(constraint);
@@ -77,10 +77,10 @@
     public event EventHandler<ConstraintEventArgs> ConstraintAdded;
     protected virtual void OnConstraintAdded(IConstraint constraint) {
-      if (ConstraintAdded != null)
+      if(ConstraintAdded != null)
         ConstraintAdded(this, new ConstraintEventArgs(constraint));
     }
     public event EventHandler<ConstraintEventArgs> ConstraintRemoved;
     protected virtual void OnConstraintRemoved(IConstraint constraint) {
-      if (ConstraintRemoved != null)
+      if(ConstraintRemoved != null)
         ConstraintRemoved(this, new ConstraintEventArgs(constraint));
     }
@@ -106,11 +106,24 @@
       }
     }
-    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
-      base.Populate(node, restoredObjects);
-      XmlNode constraintsNode = node.SelectSingleNode("Constraints");
-      if (constraintsNode != null) {
+    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+    //  base.Populate(node, restoredObjects);
+    //  XmlNode constraintsNode = node.SelectSingleNode("Constraints");
+    //  if(constraintsNode != null) {
+    //    myConstraints.Clear();
+    //    foreach(XmlNode constraintNode in constraintsNode.ChildNodes)
+    //      AddConstraint((IConstraint)PersistenceManager.Restore(constraintNode, restoredObjects));
+    //  }
+    //}
+    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      base.Populate(reader, restoredObjects);
+      reader.Read();
+      if(reader.Name == "Constraints") {
         myConstraints.Clear();
-        foreach (XmlNode constraintNode in constraintsNode.ChildNodes)
-          AddConstraint((IConstraint)PersistenceManager.Restore(constraintNode, restoredObjects));
+        reader.Read();
+        while(reader.IsStartElement()) {
+          AddConstraint((IConstraint)PersistenceManager.Restore(reader, restoredObjects));
+          reader.Skip();
+        }
+        reader.ReadEndElement();
       }
     }
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/EngineBase.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/EngineBase.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/EngineBase.cs	(revision 125)
@@ -204,15 +204,26 @@
       writer.WriteEndElement(); // </ExecutionTime>
     }
-    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
-      base.Populate(node, restoredObjects);
-      myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(node.SelectSingleNode("OperatorGraph"), restoredObjects);
-      myGlobalScope = (IScope)PersistenceManager.Restore(node.SelectSingleNode("GlobalScope"), restoredObjects);
-
-      XmlNode stackNode = node.SelectSingleNode("ExecutionStack");
-      for (int i = stackNode.ChildNodes.Count - 1; i >= 0; i--)
-        myExecutionStack.Push((IOperation)PersistenceManager.Restore(stackNode.ChildNodes[i], restoredObjects));
-
-      XmlNode timeNode = node.SelectSingleNode("ExecutionTime");
-      myExecutionTime = TimeSpan.Parse(timeNode.InnerText);
+    public override void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) {
+      base.Populate(reader, restoredObjects);
+      reader.Read();
+      myOperatorGraph = (IOperatorGraph)PersistenceManager.Restore(reader, "OperatorGraph", restoredObjects);
+      reader.Skip();
+      myGlobalScope = (IScope)PersistenceManager.Restore(reader, "GlobalScope", restoredObjects);
+      reader.Skip();
+      if(reader.Name!="ExecutionStack") throw new XmlException("Expected \"ExecutionStack\", found: \""+reader.Name+"\"");
+      List<IOperation> operationList = new List<IOperation>();
+      if(!reader.IsEmptyElement) {
+        reader.Read();
+        while(reader.IsStartElement()) {
+          operationList.Insert(0, (IOperation)PersistenceManager.Restore(reader, restoredObjects));
+          reader.Skip();
+        }
+        reader.ReadEndElement();
+      } else {
+        reader.Read();
+      }
+      foreach(IOperation op in operationList)
+        myExecutionStack.Push(op);
+      myExecutionTime = TimeSpan.Parse(reader.ReadElementString("ExecutionTime"));
     }
     #endregion
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/Interfaces/IStorable.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/Interfaces/IStorable.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/Interfaces/IStorable.cs	(revision 125)
@@ -34,5 +34,5 @@
     //XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects);
     void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects);
-    void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects);
+    void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects);
   }
 }
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorBase.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorBase.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorBase.cs	(revision 125)
@@ -462,8 +462,9 @@
     //}
     public override void Persist(string name, XmlWriter writer, IDictionary<Guid, IStorable> persistedObjects) {
-      base.Persist(name, writer, persistedObjects);
       writer.WriteAttributeString("Name", Name);
       if(Breakpoint)
         writer.WriteAttributeString("BreakPoint", Breakpoint.ToString());
+      base.Persist(name, writer, persistedObjects);
+
       writer.WriteStartElement("SubOperators");
       for(int i = 0; i < SubOperators.Count; i++)
@@ -479,20 +480,63 @@
       writer.WriteEndElement(); // </Variables>
     }
-    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
-      base.Populate(node, restoredObjects);
-      myName = node.Attributes["Name"].Value;
-      if (node.Attributes["Breakpoint"] != null)
-        myBreakpoint = bool.Parse(node.Attributes["Breakpoint"].Value);
-      XmlNode subOperatorsNode = node.SelectSingleNode("SubOperators");
-      for (int i = 0; i < subOperatorsNode.ChildNodes.Count; i++)
-        AddSubOperator((IOperator)PersistenceManager.Restore(subOperatorsNode.ChildNodes[i], restoredObjects));
-      XmlNode infosNode = node.SelectSingleNode("VariableInfos");
+    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+    //  base.Populate(node, restoredObjects);
+    //  myName = node.Attributes["Name"].Value;
+    //  if(node.Attributes["Breakpoint"] != null)
+    //    myBreakpoint = bool.Parse(node.Attributes["Breakpoint"].Value);
+    //  XmlNode subOperatorsNode = node.SelectSingleNode("SubOperators");
+    //  for(int i = 0; i < subOperatorsNode.ChildNodes.Count; i++)
+    //    AddSubOperator((IOperator)PersistenceManager.Restore(subOperatorsNode.ChildNodes[i], restoredObjects));
+    //  XmlNode infosNode = node.SelectSingleNode("VariableInfos");
+    //  myVariableInfos.Clear();
+    //  foreach(XmlNode infoNode in infosNode.ChildNodes)
+    //    AddVariableInfo((IVariableInfo)PersistenceManager.Restore(infoNode, restoredObjects));
+    //  XmlNode variablesNode = node.SelectSingleNode("Variables");
+    //  myVariables.Clear();
+    //  foreach(XmlNode variableNode in variablesNode.ChildNodes)
+    //    AddVariable((IVariable)PersistenceManager.Restore(variableNode, restoredObjects));
+    //}
+    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      myName = reader["Name"];
+      if(reader["Breakpoint"] != null)
+        myBreakpoint = bool.Parse(reader["Breakpoint"]);
+
+      base.Populate(reader, restoredObjects);
+      // constraintItemBase already reads to the next subelement
+      if(reader.Name != "SubOperators") throw new XmlException("Expected: \"SubOperators\" found: \"" + reader.Name+"\"");
+      if(!reader.IsEmptyElement) {
+        reader.Read();
+        while(reader.IsStartElement()) {
+          AddSubOperator((IOperator)PersistenceManager.Restore(reader, restoredObjects));
+          reader.Skip();
+        }
+        reader.ReadEndElement();
+      } else {
+        reader.Read();
+      }
+      if(reader.Name != "VariableInfos") throw new XmlException("Expected: \"VariableInfos\" found: \"" + reader.Name+"\"");
       myVariableInfos.Clear();
-      foreach (XmlNode infoNode in infosNode.ChildNodes)
-        AddVariableInfo((IVariableInfo)PersistenceManager.Restore(infoNode, restoredObjects));
-      XmlNode variablesNode = node.SelectSingleNode("Variables");
+      if(!reader.IsEmptyElement) {
+        reader.Read();
+        while(reader.IsStartElement()) {        
+          AddVariableInfo((IVariableInfo)PersistenceManager.Restore(reader, restoredObjects));
+          reader.Skip();
+        }
+        reader.ReadEndElement();
+      } else {
+        reader.Read();
+      }
+      if(reader.Name != "Variables") throw new XmlException("Expected: \"Variables\" found: \"" + reader.Name + "\"");
       myVariables.Clear();
-      foreach (XmlNode variableNode in variablesNode.ChildNodes)
-        AddVariable((IVariable)PersistenceManager.Restore(variableNode, restoredObjects));
+      if(!reader.IsEmptyElement) {
+        reader.Read();
+        while(reader.IsStartElement()) {
+          AddVariable((IVariable)PersistenceManager.Restore(reader, restoredObjects));
+          reader.Skip();
+        }
+        reader.ReadEndElement();
+      } else {
+        reader.Read();
+      }
     }
     #endregion
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorGraph.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorGraph.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorGraph.cs	(revision 125)
@@ -35,5 +35,5 @@
       get { return myInitialOperator; }
       set {
-        if (myInitialOperator != value) {
+        if(myInitialOperator != value) {
           myInitialOperator = value;
           OnInitialOperatorChanged();
@@ -53,7 +53,7 @@
       OperatorGraph clone = new OperatorGraph();
       clonedObjects.Add(Guid, clone);
-      foreach (IOperator op in Operators)
+      foreach(IOperator op in Operators)
         clone.AddOperator((IOperator)Auxiliary.Clone(op, clonedObjects));
-      if (InitialOperator != null)
+      if(InitialOperator != null)
         clone.myInitialOperator = (IOperator)Auxiliary.Clone(InitialOperator, clonedObjects);
       return clone;
@@ -61,9 +61,9 @@
 
     public void AddOperator(IOperator op) {
-      if (!myOperators.ContainsKey(op.Guid)) {
+      if(!myOperators.ContainsKey(op.Guid)) {
         myOperators.Add(op.Guid, op);
         OnOperatorAdded(op);
 
-        foreach (IOperator subOperator in op.SubOperators)
+        foreach(IOperator subOperator in op.SubOperators)
           AddOperator(subOperator);
       }
@@ -71,9 +71,9 @@
     public void RemoveOperator(Guid guid) {
       IOperator op = GetOperator(guid);
-      if (op != null) {
-        foreach (IOperator o in Operators) {
+      if(op != null) {
+        foreach(IOperator o in Operators) {
           int i = 0;
-          while (i < o.SubOperators.Count) {
-            if (o.SubOperators[i] == op)
+          while(i < o.SubOperators.Count) {
+            if(o.SubOperators[i] == op)
               o.RemoveSubOperator(i);
             else
@@ -81,5 +81,5 @@
           }
         }
-        if (InitialOperator == op)
+        if(InitialOperator == op)
           InitialOperator = null;
         myOperators.Remove(op.Guid);
@@ -89,5 +89,5 @@
     public IOperator GetOperator(Guid guid) {
       IOperator op;
-      if (myOperators.TryGetValue(guid, out op))
+      if(myOperators.TryGetValue(guid, out op))
         return op;
       else
@@ -97,9 +97,9 @@
       Guid[] guids = new Guid[Operators.Count];
       int i = 0;
-      foreach (IOperator op in Operators) {
+      foreach(IOperator op in Operators) {
         guids[i] = op.Guid;
         i++;
       }
-      for (int j = 0; j < guids.Length; j++)
+      for(int j = 0; j < guids.Length; j++)
         RemoveOperator(guids[j]);
     }
@@ -107,15 +107,15 @@
     public event EventHandler<OperatorEventArgs> OperatorAdded;
     protected virtual void OnOperatorAdded(IOperator op) {
-      if (OperatorAdded != null)
+      if(OperatorAdded != null)
         OperatorAdded(this, new OperatorEventArgs(op));
     }
     public event EventHandler<OperatorEventArgs> OperatorRemoved;
     protected virtual void OnOperatorRemoved(IOperator op) {
-      if (OperatorRemoved != null)
+      if(OperatorRemoved != null)
         OperatorRemoved(this, new OperatorEventArgs(op));
     }
     public event EventHandler InitialOperatorChanged;
     protected virtual void OnInitialOperatorChanged() {
-      if (InitialOperatorChanged != null)
+      if(InitialOperatorChanged != null)
         InitialOperatorChanged(this, new EventArgs());
     }
@@ -141,17 +141,33 @@
         PersistenceManager.Persist("InitialOperator", InitialOperator, writer, persistedObjects);
     }
-    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
-      base.Populate(node, restoredObjects);
+    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+    //  base.Populate(node, restoredObjects);
 
-      XmlNode ops = node.SelectSingleNode("Operators");
-      for (int i = 0; i < ops.ChildNodes.Count; i++) {
-        XmlNode opNode = ops.ChildNodes[i];
-        IOperator op = (IOperator)PersistenceManager.Restore(opNode, restoredObjects);
+    //  XmlNode ops = node.SelectSingleNode("Operators");
+    //  for(int i = 0; i < ops.ChildNodes.Count; i++) {
+    //    XmlNode opNode = ops.ChildNodes[i];
+    //    IOperator op = (IOperator)PersistenceManager.Restore(opNode, restoredObjects);
+    //    myOperators.Add(op.Guid, op);
+    //  }
+
+    //  XmlNode initial = node.SelectSingleNode("InitialOperator");
+    //  if(initial != null)
+    //    myInitialOperator = (IOperator)PersistenceManager.Restore(initial, restoredObjects);
+    //}
+    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      base.Populate(reader, restoredObjects);
+
+      reader.Read();
+      if(reader.Name != "Operators") throw new XmlException("Expected: Operators found: " + reader.Name);
+      reader.Read();
+      while(reader.IsStartElement()) {
+        IOperator op = (IOperator)PersistenceManager.Restore(reader, restoredObjects);
+        reader.Skip();
         myOperators.Add(op.Guid, op);
       }
-
-      XmlNode initial = node.SelectSingleNode("InitialOperator");
-      if (initial != null)
-        myInitialOperator = (IOperator)PersistenceManager.Restore(initial, restoredObjects);
+      reader.ReadEndElement();
+      if(reader.IsStartElement()) {
+        myInitialOperator = (IOperator)PersistenceManager.Restore(reader, "InitialOperator", restoredObjects);
+      }
     }
     #endregion
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorGroup.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorGroup.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorGroup.cs	(revision 125)
@@ -110,13 +110,40 @@
       writer.WriteEndElement(); // </Operators>
     }
-    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
-      base.Populate(node, restoredObjects);
-      myName = node.Attributes["Name"].Value;
-      XmlNode subGroupsNode = node.SelectSingleNode("SubGroups");
-      foreach (XmlNode subGroupNode in subGroupsNode.ChildNodes)
-        AddSubGroup((IOperatorGroup)PersistenceManager.Restore(subGroupNode, restoredObjects));
-      XmlNode operatorsNode = node.SelectSingleNode("Operators");
-      foreach (XmlNode operatorNode in operatorsNode.ChildNodes)
-        AddOperator((IOperator)PersistenceManager.Restore(operatorNode, restoredObjects));
+    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+    //  base.Populate(node, restoredObjects);
+    //  myName = node.Attributes["Name"].Value;
+    //  XmlNode subGroupsNode = node.SelectSingleNode("SubGroups");
+    //  foreach(XmlNode subGroupNode in subGroupsNode.ChildNodes)
+    //    AddSubGroup((IOperatorGroup)PersistenceManager.Restore(subGroupNode, restoredObjects));
+    //  XmlNode operatorsNode = node.SelectSingleNode("Operators");
+    //  foreach(XmlNode operatorNode in operatorsNode.ChildNodes)
+    //    AddOperator((IOperator)PersistenceManager.Restore(operatorNode, restoredObjects));
+    //}
+    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      myName = reader["Name"];
+      base.Populate(reader, restoredObjects);
+      reader.Read();
+      if(reader.Name != "SubGroups") throw new XmlException("Expected: \"SubGroups\", found: \"" + reader.Name + "\"");
+      if(!reader.IsEmptyElement) {
+        reader.Read();
+        while(reader.IsStartElement()) {
+          AddSubGroup((IOperatorGroup)PersistenceManager.Restore(reader, restoredObjects));
+          reader.Skip();
+        }
+        reader.ReadEndElement();
+      } else {
+        reader.Read();
+      }
+      if(reader.Name != "Operators") throw new XmlException("Expected: \"Operators\", found: \"" + reader.Name + "\"");
+      if(!reader.IsEmptyElement) {
+        reader.Read();
+        while(reader.IsStartElement()) {
+          AddOperator((IOperator)PersistenceManager.Restore(reader, restoredObjects));
+          reader.Skip();
+        }
+        reader.ReadEndElement();
+      } else {
+        reader.Read();
+      }
     }
     #endregion
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorLibrary.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/OperatorLibrary.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/OperatorLibrary.cs	(revision 125)
@@ -60,7 +60,9 @@
       PersistenceManager.Persist("OperatorGroup", Group, writer, persistedObjects);
     }
-    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
-      base.Populate(node, restoredObjects);
-      myGroup = (IOperatorGroup)PersistenceManager.Restore(node.SelectSingleNode("OperatorGroup"), restoredObjects);
+    public override void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) {
+      base.Populate(reader, restoredObjects);
+      reader.Read();
+      myGroup = (IOperatorGroup)PersistenceManager.Restore(reader, "OperatorGroup", restoredObjects);
+      reader.Read();
     }
     #endregion
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/PersistenceManager.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/PersistenceManager.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/PersistenceManager.cs	(revision 125)
@@ -57,13 +57,31 @@
     }
 
-    public static IStorable Restore(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
-      Guid guid = new Guid(node.Attributes["GUID"].Value);
-      if (restoredObjects.ContainsKey(guid)) {
+    public static IStorable Restore(XmlReader reader, string elementName, IDictionary<Guid, IStorable> restoredObjects) {
+      reader = reader.ReadSubtree();
+      reader.Read();
+      if(reader.Name != elementName) throw new XmlException("Expected: \"" + elementName + "\" found: \"" + reader.Name+"\"");
+      IStorable result = RestoreElement(reader, restoredObjects);
+      reader.Read();
+      reader.Close();
+      return result;
+    }
+
+    public static IStorable Restore(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      reader = reader.ReadSubtree();
+      reader.Read();
+      IStorable result = RestoreElement(reader, restoredObjects);
+      reader.Read();
+      reader.Close();
+      return result;
+    }
+    private static IStorable RestoreElement(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      Guid guid = new Guid(reader["GUID"]);
+      if(restoredObjects.ContainsKey(guid)) {        
         return restoredObjects[guid];
       } else {
-        Type type = Type.GetType(node.Attributes["Type"].Value, true);
+        Type type = Type.GetType(reader["Type"], true);
         IStorable instance = (IStorable)Activator.CreateInstance(type);
         restoredObjects.Add(guid, instance);
-        instance.Populate(node, restoredObjects);
+        instance.Populate(reader, restoredObjects);
         return instance;
       }
@@ -89,7 +107,10 @@
     }
     public static IStorable Load(Stream stream) {
-      XmlDocument doc = new XmlDocument();
-      doc.Load(stream);
-      return PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
+      XmlReaderSettings settings = new XmlReaderSettings();
+      settings.IgnoreComments = true;
+      settings.IgnoreWhitespace = true;
+      XmlReader reader = XmlReader.Create(stream, settings);
+      reader.MoveToContent(); // read "<?xml version="1.0"?/>
+      return PersistenceManager.RestoreElement(reader, new Dictionary<Guid, IStorable>());
     }
 
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/Scope.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/Scope.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/Scope.cs	(revision 125)
@@ -311,24 +311,62 @@
       writer.WriteEndElement(); // </SubScopes>
     }
-    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
-      base.Populate(node, restoredObjects);
-      myName = node.Attributes["Name"].Value;
-
-      XmlNode variables = node.SelectSingleNode("Variables");
-      foreach (XmlNode variableNode in variables.ChildNodes) {
-        IVariable variable = (IVariable)PersistenceManager.Restore(variableNode, restoredObjects);
-        AddVariable(variable);
-      }
-
-      XmlNode aliases = node.SelectSingleNode("Aliases");
-      if (aliases != null) {
-        foreach (XmlNode aliasNode in aliases.ChildNodes)
-          AddAlias(aliasNode.Attributes["Alias"].Value, aliasNode.Attributes["Name"].Value);
-      }
-
-      XmlNode subScopes = node.SelectSingleNode("SubScopes");
-      for (int i = 0; i < subScopes.ChildNodes.Count; i++) {
-        IScope scope = (IScope)PersistenceManager.Restore(subScopes.ChildNodes[i], restoredObjects);
-        AddSubScope(scope);
+    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+    //  base.Populate(node, restoredObjects);
+    //  myName = node.Attributes["Name"].Value;
+
+    //  XmlNode variables = node.SelectSingleNode("Variables");
+    //  foreach(XmlNode variableNode in variables.ChildNodes) {
+    //    IVariable variable = (IVariable)PersistenceManager.Restore(variableNode, restoredObjects);
+    //    AddVariable(variable);
+    //  }
+
+    //  XmlNode aliases = node.SelectSingleNode("Aliases");
+    //  if(aliases != null) {
+    //    foreach(XmlNode aliasNode in aliases.ChildNodes)
+    //      AddAlias(aliasNode.Attributes["Alias"].Value, aliasNode.Attributes["Name"].Value);
+    //  }
+
+    //  XmlNode subScopes = node.SelectSingleNode("SubScopes");
+    //  for(int i = 0; i < subScopes.ChildNodes.Count; i++) {
+    //    IScope scope = (IScope)PersistenceManager.Restore(subScopes.ChildNodes[i], restoredObjects);
+    //    AddSubScope(scope);
+    //  }
+    //}
+    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      myName = reader["Name"];
+      base.Populate(reader, restoredObjects);
+      reader.Read();
+      if(reader.Name != "Variables") throw new XmlException("Expected: \"Variables\", found: \""+reader.Name+"\"");
+      if(!reader.IsEmptyElement) {
+        reader.Read();
+        while(reader.IsStartElement()) {
+          IVariable variable = (IVariable)PersistenceManager.Restore(reader, restoredObjects);
+          reader.Skip();
+          AddVariable(variable);
+        }
+        reader.ReadEndElement();
+      } else {
+        reader.Read();
+      }
+      if(reader.Name == "Aliases" && !reader.IsEmptyElement) {
+        reader.Read();
+        while(reader.IsStartElement()) {
+          AddAlias(reader["Alias"], reader["Name"]);
+        }
+        reader.ReadEndElement();
+      } else {
+        reader.Read();
+      }
+      if(reader.Name != "SubScopes") throw new XmlException("Expected: \"SubScopes\", found: \"" + reader.Name + "\"");
+      if(!reader.IsEmptyElement) {
+        reader.Read();
+        while(reader.IsStartElement()) {
+          IScope scope = (IScope)PersistenceManager.Restore(reader, restoredObjects);
+          reader.Skip();
+          AddSubScope(scope);
+        }
+        reader.ReadEndElement();
+      } else {
+        reader.Read();
       }
     }
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/StorableBase.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/StorableBase.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/StorableBase.cs	(revision 125)
@@ -59,6 +59,6 @@
       writer.WriteAttributeString("GUID", Guid.ToString());
     }
-    public virtual void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
-      myGuid = new Guid(node.Attributes["GUID"].Value);
+    public virtual void Populate(XmlReader reader, IDictionary<Guid,IStorable> restoredObjects) {
+      myGuid = new Guid(reader["GUID"]);
     }
   }
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/Variable.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/Variable.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/Variable.cs	(revision 125)
@@ -115,9 +115,15 @@
         PersistenceManager.Persist("Value", Value, writer, persistedObjects);
     }
-    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
-      myName = node.Attributes["Name"].Value;
-      XmlNode valueNode = node.SelectSingleNode("Value");
-      if (valueNode != null)
-        myValue = (IItem)PersistenceManager.Restore(valueNode, restoredObjects);
+    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+    //  myName = node.Attributes["Name"].Value;
+    //  XmlNode valueNode = node.SelectSingleNode("Value");
+    //  if(valueNode != null)
+    //    myValue = (IItem)PersistenceManager.Restore(valueNode, restoredObjects);
+    //}
+    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      myName = reader["Name"];
+      reader.Read();
+      if(reader.IsStartElement())
+        myValue = (IItem)PersistenceManager.Restore(reader, "Value", restoredObjects);
     }
     #endregion
Index: branches/XmlReaderWriterBranch/HeuristicLab.Core/VariableInfo.cs
===================================================================
--- branches/XmlTextWriterBranch/HeuristicLab.Core/VariableInfo.cs	(revision 119)
+++ branches/XmlReaderWriterBranch/HeuristicLab.Core/VariableInfo.cs	(revision 125)
@@ -146,11 +146,19 @@
       writer.WriteAttributeString("Local", Local.ToString());
     }
-    public override void Populate(XmlNode node, IDictionary<Guid,IStorable> restoredObjects) {
-      myActualName = node.Attributes["ActualName"].Value;
-      myFormalName = node.Attributes["FormalName"].Value;
-      myDescription = node.Attributes["Description"].Value;
-      myDataType = Type.GetType(node.Attributes["DataType"].Value, true);
-      myKind = (VariableKind)Enum.Parse(typeof(VariableKind), node.Attributes["Kind"].Value);
-      myLocal = bool.Parse(node.Attributes["Local"].Value);
+    //public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
+    //  myActualName = node.Attributes["ActualName"].Value;
+    //  myFormalName = node.Attributes["FormalName"].Value;
+    //  myDescription = node.Attributes["Description"].Value;
+    //  myDataType = Type.GetType(node.Attributes["DataType"].Value, true);
+    //  myKind = (VariableKind)Enum.Parse(typeof(VariableKind), node.Attributes["Kind"].Value);
+    //  myLocal = bool.Parse(node.Attributes["Local"].Value);
+    //}
+    public override void Populate(XmlReader reader, IDictionary<Guid, IStorable> restoredObjects) {
+      myActualName = reader["ActualName"];
+      myFormalName = reader["FormalName"];
+      myDescription = reader["Description"];
+      myDataType = Type.GetType(reader["DataType"], true);
+      myKind = (VariableKind)Enum.Parse(typeof(VariableKind), reader["Kind"]);
+      myLocal = bool.Parse(reader["Local"]);
     }
     #endregion
