I am trying to add the datas obtained from my list picker into an xml. I could not figure out where the mistake is since I am new to this.
C# code
using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
{
var isoFileStream = new IsolatedStorageFileStream(@"D:\Backup\task\Project\
Project\FinalDatas.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite, store); // I get an exception here
var xDoc = XDocument.Load(isoFileStream);
isoFileStream.Close();
var contactsElement =
new XElement("Noofppl",
new XElement("ppl",
new XElement("Adults", ListAdults.SelectedItem.ToString()),
new XElement("children", ListChildren.SelectedItem.ToString())));
// IsolatedStorageFileStream location = new IsolatedStorageFileStream(ListAdults.SelectedItem.ToString() + ".item", System.IO.FileMode.Create, storage);
xDoc.Root.Add(contactsElement);
xDoc.Save(isoFileStream);
isoFileStream.Close();
}
I have my xml file on the same project and the code likes
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<Noofppl>
<ppl>
<Adults>
</Adults>
<children>
</children>
</ppl>
</Noofppl>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.