title: Override values in one Xml file from another
body: <p>Looking for a way to merge to XML files where the modified attributes in the second file should override the values of the objects in the first file. Seems like this should be doable with linq to xml but having some trouble figuring out how to do it.</p>
  
  <p>For example take the following two XML files:</p>
  
  <p>File 1:</p>
  
  <pre><code>&lt;root&gt;
     &lt;foo name="1"&gt;
       &lt;val1&gt;hello&lt;/val1&gt;
       &lt;val2&gt;world&lt;/val2&gt;
     &lt;/foo&gt;
     &lt;foo name="2"&gt;
       &lt;val1&gt;bye&lt;/val1&gt;
     &lt;/foo&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>File 2:</p>
  
  <pre><code>&lt;root&gt;
     &lt;foo name="1"&gt;
       &lt;val2&gt;friend&lt;/val2&gt;
     &lt;/foo&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>The desired end result would be to merge File 2 in to File 1 and end up with</p>
  
  <pre><code>&lt;root&gt;
     &lt;foo name="1"&gt;
       &lt;val1&gt;hello&lt;/val1&gt;
       &lt;val2&gt;friend&lt;/val2&gt;
     &lt;/foo&gt;
     &lt;foo name="2"&gt;
       &lt;val1&gt;bye&lt;/val1&gt;
     &lt;/foo&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Sub 'foo' elements should be uniquely identified by their 'name' value with any set values in File 2 overriding the values in File 1.</p>
  
  <p>Any pointers in the right direction would be much appreciated, thanks!</p>