title: Writing XML in loop c#
body: <p>How would i write the xml out like</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;calibration&gt;
    &lt;ZoomLevel 250&gt;0.0100502512562814&lt;/ZoomLevel 250&gt;
    &lt;ZoomLevel 250&gt;0.0100502512562814&lt;/ZoomLevel 250&gt;
    ........
  &lt;/calibration&gt;
  </code></pre>
  
  <p>I know how to write it out but i cant write it out in a loop which i need to atm the i have for writting the xml sheet is</p>
  
  <pre><code>public void XMLWrite(Dictionary&lt;string, double&gt; dict)
  {
      //write the dictonary into an xml file
      XmlDocument doc = new XmlDocument();
      XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
      doc.AppendChild(docNode);
  
      XmlNode productsNode = doc.CreateElement("calibration");
      doc.AppendChild(productsNode);
  
      foreach (KeyValuePair&lt;string, double&gt; entry in dict)
      {
          XmlNode zoomNode = doc.CreateElement("ZoomLevel");
  
          XmlAttribute ZoomLevel = doc.CreateAttribute(entry.Key.ToString());
          //XmlElement PixelSize = doc.CreateElement (entry.key = entry.Value.ToString());
          zoomNode.Attributes.Append(ZoomLevel);
  
          productsNode.AppendChild(zoomNode);
      }
      doc.Save(pathName);
  }
  </code></pre>