Xmlns='' was not expected when deserializing nested classes?

After alot of testing I have finally found an error. It was not an encoding problem, neither was the problem in the other code nor it was the missing namespace.

After alot of testing I have finally found an error. It was not an encoding problem, neither was the problem in the other code nor it was the missing namespace. The missing part was the annotation for type of objects in the array when deserializing.So I had to change my StatusUpdate class to XmlRoot("StatusUpdate") public class StatusUpdate { public StatusUpdate() { } XmlArray("Players"), XmlArrayItem(ElementName = "Player", Type = typeof(PlayerInfo)) public PlayerInfo Players { get; set; } XmlElement("Command") public ServerCommand Update { get; set; } } and serialization started working perfectly.

I hope that helps someone else.

That's actually highly unusual to see when using the XmlSerializer. The root element should always look like this: (Correction: The XmlSerializer does appear to work without these on deserialization, but it always adds them on serialization, so something's fishy if they're missing. ) Second edit: I strongly suspect that your issue is encoding-related.

I don't know why you have to mess with the serialization so much and can't just use the default UTF-8 encoding, but regardless, the following code works without any errors: MyClass m = new MyClass() { X = 4, Y = 8 }; byte data = SerializeObject(m); string xml = Encoding.Unicode. GetString(data); Console. WriteLine(xml); m = (MyClass)DeserializeXml(xml, typeof(MyClass)); So if something is failing for you, it's very likely going wrong during the conversion of byte array to XML string on the client side.

That's the only code you still haven't posted.

That's actually highly unusual to see when using the XmlSerializer. The root element should always look like this.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions