title: Remove XML Version Tag from ElementTree using Python
body: <p>I've needed to manually add my xml version as a string so I need to remove the xml version generated by ElementTree. How do I remove the duplicate xml version node on line 3?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 2.0//EN" "http://www.w3.org/2001/SMIL20/SMIL20.dtd"&gt;
  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;smil xmlns="http://www.w3.org/2001/SMIL20/Language"&gt;
    &lt;head&gt;
      &lt;meta base="rtmp://cp23636.edgefcs.net/ondemand"/&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;switch&gt;
        &lt;video src="mp4:soundcheck/1/clay_aiken/02_sc_ca_sorry_256.mp4" system-bitrate="336000"/&gt;
        &lt;video src="mp4:soundcheck/1/clay_aiken/02_sc_ca_sorry_512.mp4" system-bitrate="592000"/&gt;
        &lt;video src="mp4:soundcheck/1/clay_aiken/02_sc_ca_sorry_768.mp4" system-bitrate="848000"/&gt;
        &lt;video src="mp4:soundcheck/1/clay_aiken/02_sc_ca_sorry_1128.mp4" system-bitrate="1208000"/&gt;
      &lt;/switch&gt;
    &lt;/body&gt;
  &lt;/smil&gt;
  </code></pre>
  
  <p>This is the script;</p>
  
  <pre><code>def prettify(elem):
      """Return a pretty-printed XML string for the Element.
      """
      rough_string = ElementTree.tostring(elem, 'utf-8')
      reparsed = minidom.parseString(rough_string)
      return reparsed.toprettyxml(indent="  ", encoding = 'utf-8')
  
  xmlver = '&lt;?xml version="1.0" encoding="utf-8"?&gt;\n'
  doctype = '&lt;!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 2.0//EN" "http://www.w3.org/2001/SMIL20/SMIL20.dtd"&gt;\n'
  
  with open(sys.argv[1], 'rU') as f:
      reader = csv.DictReader(f)
      for row in reader:
          root = Element('smil')
          root.set('xmlns', 'http://www.w3.org/2001/SMIL20/Language')
          head = SubElement(root, 'head')
          meta = SubElement(head, 'meta base="rtmp://cp23636.edgefcs.net/ondemand"')
          body = SubElement(root, 'body')
  
          switch_tag = ElementTree.SubElement(body, 'switch')
  
          for suffix, bitrate in video_data:
              attrs = {'src': ("mp4:soundcheck/{year}/{id}/{file_root_name}_{suffix}.mp4"
                               .format(suffix=str(suffix), **row)),
                       'system-bitrate': str(bitrate),
                       }
              ElementTree.SubElement(switch_tag, 'video', attrs)
  </code></pre>