How to access a file inside an isolated WindowsStorageFileStream phone.

In my project, I want to create an xml file and save it, and then extract the xml file. this is my code:

XDocument doc = new XDocument(new XDeclaration("1.0", "iso-8859-1", "yes"), new XElement("checkout", new XElement("currency", "BRL"), new XElement("items", new XElement("item", new XElement("id", "0001"), new XElement("description", "Dízimo"), new XElement("amount", _amount), new XElement("quantity", "1"))), //new XElement("weight", "50"), new XElement("reference", _reference), new XElement("sender", new XElement("name", _name), new XElement("email", _email), new XElement("phone", new XElement("areacode", _areacode), new XElement("number", _number))), new XElement("shipping", new XElement("type", "1"), new XElement("address", new XElement("street", _street), new XElement("number", _numberHome), new XElement("complement", _complement), new XElement("district", _district), new XElement("postalcode", _postalcode), new XElement("city", _city), new XElement("state", _state), new XElement("country", "BRA"))))); using (var storage = IsolatedStorageFile.GetUserStoreForApplication()) { using (Stream stream = storage.CreateFile(@"c:\Temp\data.xml")) { doc.Save(stream); } } 

But in another class I use:

  var xml = XDocument.Load("a.xml").ToString(); var content = new StringContent( xml, Encoding.GetEncoding("ISO-8859-1"), "application/xml"); 

to read the xml file of the namePath form, but now I want to read from IsolStorageFile how I can convert the stream object so that I can use XDocument.Load(stream) inside

+1
source share

All Articles