ExanionaltCax
New Member
I have this class called \[code\]identity\[/code\] \[code\]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; } }}\[/code\]I've serialized that class into a xml document:\[code\]<?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>\[/code\]However when I try and deseralize the xml into an \[code\]identity\[/code\] object I get errors\[quote\] There is an error in the xml document (2,2) .....
System.InvalidOperationException was not expected.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderList1.Read6_ArrayOfIdentity()\[/quote\]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.
System.InvalidOperationException was not expected.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderList1.Read6_ArrayOfIdentity()\[/quote\]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.