Hello everybody. I can read the xml file, but I can't save xml file :
Sample :
public class Subject
{
public int Id
{
get;
set;
}
public Subject()
{}
public string Name
{
get;
set;
}
public string Number
{
get;
set;
}
}
public class Student
{
public string Id
{
get;
set;
}
public Student()
{}
public string Name
{
get;
set;
}
public string IconURI
{
get;
set;
}
public List
{
get;
set;
}
}
public partial class MainPage : PhoneApplicationPage
{
public MainPage()
{
InitializeComponent();
}
public List
{
get;
set;
}
}
private void LoadXML()
{
Uri uri = new Uri("/DemoWP7;component/Save.xml", UriKind.Relative);
StreamResourceInfo xml = App.GetResourceStream(uri);
XDocument doc = XDocument.Load(xml.Stream);
XElement menu = doc.Descendants("menu").First();
Students = (from student in menu.Descendants("student")
select new Student()
{
Id = student.Attribute("id").Value,
Name = student.Attribute("name").Value,
IconURI = student.Attribute("icon").Value,
Subjects = (from subject in student.Descendants("subject")
select new Subject()
{
Name = subject.Attribute("name").Value,
Number = subject.Attribute("number").Value,
}).ToList
}).ToList
}
I need save the file .xml same this, after that LoadXML()
How can I save xml file (code) ?
Suthish NairPosted Nov 6, 2011, 2:04 PM
http://www.windowsphonegeek.com/tips/All-about-WP7-Isolated-Storage---Read-and-Save-XML-files-using-XmlWriter
http://windowsphone.interoperabilitybridges.com/articles/android-to-wp7-chapter-7-xml-parsing-in-windows-phone-7-and-android
http://stackoverflow.com/questions/7875036/read-xml-file-and-save-content-into-memory-wp7