I have a question about XML serialization and deserialization. Does the serialization class have to be exactly the same same as the XML. Can the order be different?
What happens if the XML has one fewer node then the class has?
And if I have many different XML coming in with different XML structure, how can I handle this different structure in the serialization class?
Thanks
Class properties do not really have an ordering, so the ordering of the nodes in the XML does not have any particular meaning – it can be anything.
If a node is missing in the XML the corresponding class property won’t be set – so it will have its default value, or whatever value the class construuctor set it to.
Different XML structures can be handled by the same class, with some restrictions though – without specific examples it is diffcult to say.