Deserialize XML objects based on others
<p>I wonder if there is a simple way of deserializing xml files to larger objects without the need to specify each element again. So I want xml elements to be based on other elements of the same type and only specify the differences.</p>

<p>Example class:</p>

<pre><code>ClassA
{
    [XmlElement("val1")]
    public AnySerializableObject val1;
    [XmlElement("val2")]
    public AnySerializableObject val2;
    [XmlElement("val3")]
    public AnySerializableObject val3;
}
</code></pre>

<p>Example XML contents:</p>

<pre><code>&lt;classA id="object1"&gt;
  &lt;val1&gt;anything&lt;/val1&gt;
  &lt;val2&gt;whatever&lt;/val2&gt;
  &lt;val3&gt;important&lt;/val3&gt;
&lt;/classA&gt;
&lt;classA id="object2" template="object1"&gt;
  &lt;val3&gt;not really important&lt;/val3&gt;
&lt;/classA&gt;
</code></pre>

<p>Simple serializing makes two ClassA objects:</p>

<pre><code>object1: val1 = anything, val2 = whatever, val3 = important  
object2: val1 = null, val2 = null, val3 = not really important
</code></pre>

<p>Is there a simple way to read the xml file so object2 uses values of object1 which are not specified?</p>

<p>So it'd be </p>

<pre><code>object2: val1 = anything, val2 = whatever, val3 = not really important
</code></pre>

<p>Or do I have to write my own Serializer which seems to be quite complex?</p>