Hi again.
I have a list of songs which I want to output to an external XML file using a smart device (pocket pc).
String path = GetAppDir();
string filePath = path + @"\output\songs.xml";
XmlWriter xmlOut = XmlWriter.Create(filePath, settings);
xmlOut.WriteStartDocument();
xmlOut.WriteStartElement("Songs");
foreach (Song songTmp in finalbasket)
{
xmlOut.WriteStartElement("Songs");
xmlOut.WriteAttributeString("Name", songTmp.SongName);
xmlOut.WriteElementString("Artist", songTmp.SongArtist);
xmlOut.WriteElementString("Price", Convert.ToString(songTmp.SongPrice));
xmlOut.WriteEndElement();
}
xmlOut.WriteEndElement();
xmlOut.Close();
The application seems to write the xml document but it always comes up empty. There are indeed items in the 'finalbasket' list. Any ideas what I am doing wrong?