What is the best object model to serialize and deserialize an XML like this :
<root>
<header>
<elementA>Example</elementA>
<elementB>Test</elementB>
</header>
<content>
<elementC>foo</elementC>
<variousTypeA>
<itemA>Test</itemA>
<itemB>Test</itemB>
<itemC>Test</itemC>
</variousTypeA>
</content>
</root>
My problem is to update the variousTypeA with an other like this :
<root>
<header>
<elementA>Example</elementA>
<elementB>Test</elementB>
</header>
<content>
<elementC>foo</elementC>
<variousTypeB>
<itemZ>Test</itemZ>
<itemY>Test</itemY>
<itemX>Test</itemX>
</variousTypeB>
</content>
</root>
What is the best option to generate XML with
XmlSerializer xmlSerializer = new XmlSerializer(typeof(variousTypeA));
and
XmlSerializer xmlSerializer = new XmlSerializer(typeof(variousTypeB));
but without repeat the common elements...
The schema must to be usable with the C# XmlSerializer class. Do you have an object model to propose ?