title: How to loop through xml elements to update one using C#
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/7096647/need-to-update-a-string-value-in-xml-using-c-sharp">Need to update a string value in XML using C#</a>  </p>
  </blockquote>
  
  
  
  <p>I have an xml file that look as follow:</p>
  
  <pre><code>&lt;MediaContent&gt;
    &lt;PublishInfo region="A"  publishState="NotPublished"  /&gt;
    &lt;PublishInfo region="B"  publishState="Published"  /&gt;
  &lt;MediaContent/&gt;
  </code></pre>
  
  <p>I want to loop throgh elements  so I can update the "publishState" of the region B to "Unpublished". I could only update the publishState of region A.</p>
  
  <p>Can anyone tell me plz how to reach the region B and Update the publishState of this region.</p>
  
  <p>Regards</p>