这个是我的程序代码?请问怎样让写出的XML文件里都一行一行的!
using (XmlTextWriter xwriter = new XmlTextWriter(songlocation , null))
{
xwriter.WriteStartDocument();
xwriter.WriteStartElement("myplayer");
xwriter.WriteStartElement("playingsongs");
xwriter.WriteAttributeString("total",songlist.Count .ToString ());
for (int i = 0; i < songlist.Count ;i++ )
{
xwriter.WriteAttributeString("song"+i.ToString (),songlist[i ].ToString ());
}
xwriter.WriteEndElement();
xwriter.WriteEndElement();
xwriter.WriteEndDocument();
xwriter.Flush();
xwriter.Close();
}
// 写入XML文档
XmlTextWriter writer = null;
try
{
writer = new XmlTextWriter(filePath, System.Text.Encoding.UTF8);
writer.Formatting = Formatting.Indented;
writer.WriteStartDocument();
writer.WriteStartElement("Log");
}
finally
{
if (writer != null)
writer.Close();
}