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

  • Home
  • SEARCH
  • 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 8482931
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:56:49+00:00 2026-06-10T19:56:49+00:00

Im pulling in xml data from the output of a php script. The way

  • 0

Im pulling in xml data from the output of a php script. The way it works is that the php script outputs the xml data to the html page and the API im using pulls all text data that is displayed on that page into a string.

so the output of the html/php is supposed to be pretty standard xml format, Ive studied it and altered the php to make sure even the smallest details are outputted correctly.

Im then using the following code to deserialize the string into my class.

public static object XmlDeserializeFromFile(Type type, string strPath)
{
    object data;

    try
    {
        using (StreamReader reader = new StreamReader(strPath))
        {
            XmlSerializer serializer = new XmlSerializer(type);
            data = serializer.Deserialize(reader);
            reader.Close();
        }
    }
    catch(Exception exception)
    {
        Debug.LogError (exception);
        data = type.GetConstructor(Type.EmptyTypes).Invoke(null);
    }

    return data;
}

So the issue is that the string gets parsed from my code without hitting an exception, which makes me think that its working on some regard. However, the class still returns null values. Ive also verified that the string is being collected properly because it is displaying the full xml content in my debugger.

To test the class Im using the following code.

    MyClass member = (MyClass)XmlDeserializeFromFile(typeof(MyClass), MyString);
    if(member != null)
    {
        Debug.Log(member.a);
    }
    else
    {
        Debug.Log("Not Loaded");
    }

And the result in my debugger keeps showing member.a = null.

My class properties are all public with {get; set;} and match the xml exactly, the class values populate correctly if i load from a file instead of a string.

  • 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-10T19:56:51+00:00Added an answer on June 10, 2026 at 7:56 pm

    Take a look at the events that are available in xmlSerializer: UnknownAttribute, UnknownElement, UnknownNode,UnreferencedObject. Set up eventshandlers to handle those events if/when they occur. The data that comes out of those events should lead you in the right direction on why data isn’t showing up in your object.

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

Sidebar

Related Questions

I'm pulling data from an XML feed and manipulating it using the awesome SimpleXMLElement.
I tried this for pulling out the data from xml to php in session
I have a large amount of data that I am pulling from an xml
I'm pulling the following XML from mediawiki API <?xml version=1.0?> <api> <query> <pages> <page
I have a sheet built that's pulling in data from an XML feed. I
My jqGrid that does a great job of pulling data from my database, but
Im pulling some data from an xml on a separate site and trying to
Okay so I'm pulling in an XML feed from feedburner, using an XMLDataSource and
I am pulling data from an XML feed via C# code. When I get
I am pulling my data from a database and I am using json. What

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.