Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8082049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:57:02+00:00 2026-06-05T16:57:02+00:00

Hi I use this code to save an xml file using (IsolatedStorageFile myIsolatedStorage =

  • 0

Hi I use this code to save an xml file

using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
        {
            using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("test.xml", FileMode.Create, myIsolatedStorage))
            {
                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Indent = true;
                using (XmlWriter writer = XmlWriter.Create(isoStream, settings))
                {

                    writer.WriteStartElement("t", "test", "urn:test");
                    writer.WriteStartElement("TestA", "");
                    writer.WriteString(lbTestA.Text);
                    writer.WriteEndElement();
                    writer.WriteStartElement("TestB", "");
                    writer.WriteString(lbTestB.Text);
                    writer.WriteEndElement();

                    writer.WriteEndDocument();

                    writer.Flush();
                }
            }
        }

And it created the right xml file checked with Isolated Storage Explorer for WP7, now I want to read only the values stored in the and Tags the only code I could use was this one

private void loadgame_Click(object sender, EventArgs e)
        {
            using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
            {
                IsolatedStorageFileStream isoFileStream = myIsolatedStorage.OpenFile("test.xml", FileMode.Open);
                using (StreamReader reader = new StreamReader(isoFileStream))
                {
                    lsScore.DataContext = reader.ReadToEnd();
                }
            }
        }

But it just reads the whole xml file as it is just a text, any ideas ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:57:06+00:00Added an answer on June 5, 2026 at 4:57 pm

    Code reading the xml file. I used a seperator between the values and later used the .Split to seperate the values

    private void loadtest_Click(object sender, EventArgs e)
            {
    
         IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication();
                    if (storage.FileExists("test.xml"))
                    {
    
              IsolatedStorageFileStream fileStream = storage.OpenFile("test.xml", FileMode.Open, FileAccess.ReadWrite);
    
                    XDocument test = XDocument.Load(fileStream);
                     string score = test.Root.Value.ToString();
    
                   string[] scores = score.Split(',');
                   foreach (string s in scores)
                   {
                      lbTestAScore.Text= scores[0].ToString();
                      lbTestBScore.Text = scores[1].ToString();
                   }
    

    The XML File

        <?xml version="1.0" encoding="utf-8"?>
    <test>
      <TeamA>300</TeamA>
      <Seperator>,</Seperator>
      <TeamB>-200</TeamB>
    </test>
    

    The output from string score = test.Root.Value.ToString();

    is 300,-200

    I think this sums it all up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created this code, it is supposed to use wordpress metabox functionality to save
I have a XML file that looks like this <Licence> <Name>Test company</Name> <Version>1.1.1.1</Version> <NumberOfServer>2</NumberOfServer>
How can I access this element: <input type=submit value=Save as XML onclick=some code goes
I am currently using an adhoc xml file to save configuration settings and it's
I use this code : MethodInvoker TileLoadCompleteMethodInvoker = delegate() { CleanStatusLabelTimer.Enabled = true; MemoryTextBox.Text
i use this code in my app. just found is not correct when compare
I use this code to connect to SQL Server 2012, but it does not
I use this code to select password field from the sql server 2012 db,
I use this code , to log $_SERVER['REMOTE_ADDR']; to my small db my issue
I use this code to update data in database table. Can reuse same code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.