title: Python and XML parsing, modifying, saving
body: <p>I have an xml file, which contains default settings for a GUI app, controlling a device:</p>
  
  <pre><code>    &lt;Settings&gt;
          &lt;Setting Name="Frame0_TypeTextBox" Type="UpDown" UpDownType="d"&gt;1&lt;/Setting&gt;
          &lt;Setting Name="Frame1_TypeTextBox" Type="UpDown" UpDownType="d"&gt;2&lt;/Setting&gt;
          &lt;Setting Name="Frame2_TypeTextBox" Type="UpDown" UpDownType="d"&gt;1&lt;/Setting&gt;
          &lt;Setting Name="messageTypeBoxManual" Type="ComboBox" UpDownType=""&gt;4&lt;/Setting&gt;
          &lt;Setting Name="Frame0_C1CounterTextBox" Type="UpDown" UpDownType="Hex"&gt;0015E0&lt;/Setting&gt;
          &lt;Setting Name="Frame1_C1CounterTextBox" Type="UpDown" UpDownType="Hex"&gt;0015E0&lt;/Setting&gt;
          &lt;Setting Name="Frame2_C1CounterTextBox" Type="UpDown" UpDownType="Hex"&gt;0015E0&lt;/Setting&gt;
          &lt;Setting Name="Frame0_CtrlMsgTextBox" Type="UpDown" UpDownType="d"&gt;2&lt;/Setting&gt;
          &lt;Setting Name="Frame1_CtrlMsgTextBox" Type="UpDown" UpDownType="d"&gt;2&lt;/Setting&gt;
          &lt;Setting Name="Frame2_CtrlMsgTextBox" Type="UpDown" UpDownType="d"&gt;2&lt;/Setting&gt;
          &lt;Setting Name="rxSeedBox" Type="UpDown" UpDownType="Hex"&gt;03777777&lt;/Setting&gt;
          &lt;Setting Name="txSeedBox" Type="UpDown" UpDownType="Hex"&gt;03777777&lt;/Setting&gt;
          &lt;Setting Name="forceRxSeed" Type="CheckBox" UpDownType=""&gt;False&lt;/Setting&gt;
      &lt;/Settings&gt;
  </code></pre>
  
  <p>There a few hundred more settings but they all follow the same convention, this file is generated by the application I mentioned and layout has to be retained in order for the app to read it again.</p>
  
  <p>What I want to do is:</p>
  
  <p>1) Read the XML</p>
  
  <p>2) Find fields with Name="rxSeedBox" and "txSeedBox" (Setting Names are unique)</p>
  
  <p>3) Edit their values from 03777777 to something else, like 05FFFFFF and 08E243AF respectively</p>
  
  <p>4) Save the modified xml so it can be loaded in the application</p>
  
  <p>Here is the code so far:</p>
  
  <pre><code>import sys
  import os
  import time
  import xml.etree.ElementTree as ET
  from socket import * # portable socket interface plus constants
  
  tree = ET.parse('txg.xml')
  root = tree.getroot()
  
  for Setting in root.findall('Setting'):
      Name = Setting.get('Name')
      Type = Setting.get('Type')
      UpDownType = Setting.get('UpDownType')
      print(Name, Type, UpDownType, Setting.text)
  </code></pre>
  
  <p>Pretty much all it does at this point is read the XML from the file and print its contents.
  I have no idea ho to search for specific, unique Name attributes and then change values.
  I tried with </p>
  
  <pre><code>value = tree.findtext('Setting') 
  </code></pre>
  
  <p>commands but the only usage I've seen so far was to change the attributes. </p>
  
  <p>I want the attributes to stay untouched but the values between   tags to be changed. 
  How do I do that with ElementTree?</p>