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 7892991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:00:30+00:00 2026-06-03T07:00:30+00:00

All, I’m working on a windows phone game that grabs some XML data from

  • 0

All,
I’m working on a windows phone game that grabs some XML data from a remote web service prior to the game loading. This updates some of the data the game uses from time to time. That part works just fine. Once it grabs the data from the web service, I’m using:

    void Response_Completed(IAsyncResult result)
    {
        HttpWebRequest request = (HttpWebRequest)result.AsyncState;
        HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
        using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))
        {
            string xml = streamReader.ReadToEnd();
            using (XmlReader reader = XmlReader.Create(new StringReader(xml)))
            {
                reader.MoveToContent();
                reader.GetAttribute(0);
                reader.MoveToContent();
                webMessage = reader.ReadInnerXml();

So now I’ve got a string of the XML in the webMessage string variable. I then write that to a file in IsolatedStorage. Again works great. My problem is when I go to read the data in:

using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream stream = myIsolatedStorage.OpenFile("Test.xml", FileMode.Open)) 
{
XmlSerializer serializer = new XmlSerializer(typeof(List<Item>));
List<Item> data = (List<Item>)serializer.Deserialize(stream);

foreach (Item item in data)
{

    System.Diagnostics.Debug.WriteLine(item.Item);
}

} 
}

So the issue is when the file gets written to isolated storage, it’s escaping all the XML markup, so when I go to read the file, instead of “<” it’s reading %lt; etc, which causes the deserialize to crap out and report invalid characters. I’m really trying to avoid looping though the XML that I grabbed from the web service, that seems wasteful, I know it’s valid XML from my own server. Does anyone know of a way to take that XML I’m getting from the web service and write it to a file in IsolatedStorage all in one shot?

Thanks in advance.

  • 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-03T07:00:32+00:00Added an answer on June 3, 2026 at 7:00 am

    I ended up populating a custom serializable custom object by looping through the XML elements returned by the web service. It wasn’t too much code at all:

            HttpWebRequest request = (HttpWebRequest)result.AsyncState;
            HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
            using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))
            {
                string xml = streamReader.ReadToEnd();
                using (XmlReader reader = XmlReader.Create(new StringReader(xml)))
                {
    
    
                    reader.MoveToContent();
                    while (reader.Read())
                    {
    
                        if (reader.NodeType == XmlNodeType.Element)
                        {
                            string objectItem = reader.ReadElementContentAsString();
                            webData.Add(new CustomObject() { Item = objectItem });
    
                        }
                    }
           }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All, I have some script tags that are not working in Wordpress. If I
All programs that I develop utilize the default Windows Design template: Besides from changing
all, I am making a game in which a sprite is move from one
All, I'm using wordpress with this and for some reason the eventDrop stopped working.
All the code/commands below are part of a PHP script that processes images from
All, I'm working on a proof of concept replacement for the windows taskbar. (Mostly
All too often I want a WPF slider that behaves like the System.Windows.Forms.TrackBar of
All I am trying to create an app that start capturing the video from
All I have found about this is that there are inconsistencies among different web
all, The code below comes from Advanced Programing in Unix Environment, it creates a

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.