title: How to write a space between each element for a XML file
body: <p>I'm trying to add a space between each element in a XML file but I have no idea how to do it
  This is what I have</p>
  
  <pre><code>if (sfdSave.ShowDialog() == DialogResult.OK)
          {
              Data data = new Data();
  
              using (XmlWriter writer = XmlWriter.Create(sfdSave.FileName))
              {
                  writer.WriteStartDocument();
                  writer.WriteStartElement("MyConnection");  
  
                  writer.WriteElementString("Host", data.Host);                               
                  writer.WriteElementString("User", data.User);                    
                  writer.WriteElementString("Password", data.Password);                   
                  writer.WriteElementString("Port", Convert.ToString(data.Port));                   
  
                  writer.WriteEndElement();
                  writer.WriteEndDocument();
                  writer.Flush();
                  writer.Close();
              }
          }
  </code></pre>
  
  <p>and this is what I did</p>
  
  <pre><code>        if (sfdSave.ShowDialog() == DialogResult.OK)
          {
              Data data = new Data();
  
              using (XmlWriter writer = XmlWriter.Create(sfdSave.FileName))
              {
                  writer.WriteStartDocument();
                  writer.WriteStartElement("MyConnection");  
  
                  writer.WriteElementString("Host", data.Host);
                  writer.WriteElementString("","\n");                               
                  writer.WriteElementString("User", data.User);
                  writer.WriteElementString("","\n");                    
                  writer.WriteElementString("Password", data.Password);
                  writer.WriteElementString("","\n");                   
                  writer.WriteElementString("Port", Convert.ToString(data.Port));
                  writer.WriteElementString("","\n");                   
  
                  writer.WriteEndElement();
                  writer.WriteEndDocument();
                  writer.Flush();
                  writer.Close();
              }
          }
  </code></pre>
  
  <p>That solution is not working</p>
  
  <p>any idea?</p>
  
  <p>Thanks</p>