C# Programming
07-30-2009, 07:40 PM
I'm trying to write a XmlDocument like so:
XmlDocument doc = new XmlDocument();
// Xml is added
StreamWriter s = new StreamWriter("output.xml");
XmlTextWriter w = new XmlTextWriter(s);
doc.WriteContentTo (w);
w.Flush();
s.Flush();
s.WriteLine();
s.Close();
But it writes all the xml on one line. How do I make it put each node on its own line?
XmlDocument doc = new XmlDocument();
// Xml is added
StreamWriter s = new StreamWriter("output.xml");
XmlTextWriter w = new XmlTextWriter(s);
doc.WriteContentTo (w);
w.Flush();
s.Flush();
s.WriteLine();
s.Close();
But it writes all the xml on one line. How do I make it put each node on its own line?