title: Find and replacing text in elementtree
body: <p>i am very new to programming and python. I am trying to find and replace a text in an xml file. Here is my xml file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!--Arbortext, Inc., 1988-2008, v.4002--&gt;
  &lt;!DOCTYPE doc PUBLIC "-//MYCOMPANY//DTD XSEIF 1/FAD 110 05 R5//EN"
   "XSEIF_R5.dtd"&gt;
  &lt;doc version="XSEIF R5"
  xmlns="urn:x-mycompany:r2:reg-doc:1551-fad.110.05:en:*"&gt;
  &lt;meta-data&gt;&lt;/meta-data&gt;
  &lt;front&gt;&lt;/front&gt; 
  &lt;body&gt;
  &lt;chl1&gt;&lt;title xml:id="id_881i"&gt;Installation&lt;/title&gt;
  &lt;p&gt;To install SDK, perform the tasks mentioned in the following
  table.&lt;/p&gt;
  &lt;p&gt;&lt;input&gt;ln -s /sim/&lt;var&gt;user_id&lt;/var&gt;/.VirtualBox $home/.VirtualBox&lt;/input
  &gt;&lt;/p&gt;
  &lt;/chl1&gt;
  &lt;/body&gt;
  &lt;/doc&gt;
   &lt;?Pub *0000021917 0?&gt;
  </code></pre>
  
  <p>I need to replace all entries of "virtual box" with "Xen". For this i tried Elementtree. But i dont know how to replace and write back to the file. Here is my try.</p>
  
  <pre><code>import xml.etree.ElementTree as ET
  tree=ET.parse('C:/My_location/1_1531-CRA 119     1364_2.xml')
  doc=tree.getroot()
  iterator=doc.getiterator()
   for body in iterator:
      old_text=body.replace("Virtualbox", "Xen")
  </code></pre>
  
  <p>The texts are available in many sub tags under body.I got the method to remove the subelement and append a new element, but didnt get to replace only the texts.    </p>