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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:00:40+00:00 2026-06-11T12:00:40+00:00

I have this class called identity namespace Game.World.Entities { [XmlRoot(Identity)] public class Identity {

  • 0

I have this class called identity

namespace Game.World.Entities
{
    [XmlRoot("Identity")]
    public class Identity
    {
        public string Name { get; set; }
        public string Texture { get; set; }
        public string HeroType { get; set; }

        public Stats Stats { get; set; }
        public ActiveAbilitites ActiveAbilitites { get; set; }
        public PassiveAbilitites PassiveAbilitites { get; set; }
    }

    public class ActiveAbilitites
    {
        [XmlElement("AbilityId")]
        public List<int> ActiveAbilitiesId { get; set; }
    }

    public class PassiveAbilitites
    {
        [XmlElement("AbilityId")]
        public List<int> PassiveAbilitiesId { get; set; }
    }

    public class Stats
    {
        public int Health { get; set; }
        public int MagicDamage { get; set; }
        public int PhysicalDamage { get; set; }
        public int Defense { get; set; }
    }
}

I’ve serialized that class into a xml document:

<?xml version="1.0" encoding="utf-8"?>
<Identity xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Name>foo</Name>
  <Texture>player</Texture>
  <HeroType>tracker</HeroType>
  <Stats>
    <Health>5</Health>
    <MagicDamage>5</MagicDamage>
    <PhysicalDamage>5</PhysicalDamage>
    <Defense>5</Defense>
  </Stats>
  <ActiveAbilitites>
    <AbilityId>1</AbilityId>
    <AbilityId>2</AbilityId>
    <AbilityId>3</AbilityId>
  </ActiveAbilitites>
  <PassiveAbilitites>
    <AbilityId>1</AbilityId>
    <AbilityId>2</AbilityId>
    <AbilityId>3</AbilityId>
  </PassiveAbilitites>
</Identity>

However when I try and deseralize the xml into an identity object I get errors

There is an error in the xml document (2,2) …..
System.InvalidOperationException was not expected.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderList1.Read6_ArrayOfIdentity()

Now this is stumping me because the xml comes from the seralization so I have no idea why I can’t deseralize it. I’m presuming I have missed an annotation tag somewhere any help on the matter would be amazing.

  • 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-11T12:00:42+00:00Added an answer on June 11, 2026 at 12:00 pm

    This turned out to be a problem with how I was deseralizing the code. I have no idea what I did to mess it up so much but I’m presuming it was to do with my string reader. I just copied and pasted some example code from Deserialize from string instead TextReader and its now working fine.

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

Sidebar

Related Questions

I have this class called SiteAsyncDownload.cs Here's the code: public class SiteAsyncDownloader { WebClient
i have this class called MemoryManager, it is supposed to implement a simple smart
I have this class called PollFrame that extends JFrame in a file called PollFrame.java
I'm trying to validate an ID. I have this class called ManejadorTickets in which
I have this small class called City that simply holds some information about a
I have a class called MyClass This class inherits IEquatable and implements equals the
Let's say I have a model class called Project, but instead of this: class
I have this in my class When the second function is called php errors
I have an enum class called Gender , and I have values in this
I have a class called MainGame, which is defined like this in my .h:

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.