C# XML - Copy an attribute to a child element
<p>For example I have an XML structure as follws:</p>

<pre><code>&lt;element1&gt;
  &lt;element 2 name = "Blah" value = "Something"&gt;
    &lt;element 3 name = "Blah" type = "Something"&gt;
    &lt;element 3 name = "Woo" type = "Wibble"&gt;
      &lt;element 4 name = "Hello"&gt;
      &lt;element 4 name = "Goodbye"&gt;
      &lt;/element4&gt;
    &lt;/element3&gt;
  &lt;element2&gt;
&lt;/element1&gt;
</code></pre>

<p>Rough structure guide only. No how would I in C# write an app that copies the value attribute in element 2 and places it in each instance of element 3, but only if it has an element 4 child?</p>

<p>For the commenter who asked for an example:</p>

<p>I wish to loop through the XML document and for each instance of element3 that contains an element4 child, I wish to copy the 'value' attribute in the element2 parent of that element3 and add it to the list of attributes in that element 3. If that makes sense :\</p>
