title: Python SAX Parser
body: <p>Please help.  I am trying to parse a large XML file and transfer the data into a CSV file.  I keep loosing a lot of the data between tags and can't figure out why.</p>
  
  <p>Here is some of the XML:</p>
  
  <pre><code>&lt;testcase internalid="1256092" name="hls_vtt_single_default_diable_vtt"&gt;
      &lt;node_order&gt;&lt;![CDATA[7]]&gt;&lt;/node_order&gt;
      &lt;externalid&gt;&lt;![CDATA[6121]]&gt;&lt;/externalid&gt;
      &lt;version&gt;&lt;![CDATA[2]]&gt;&lt;/version&gt;
      &lt;summary&gt;&lt;![CDATA[&lt;p&gt;condition: single subtitle track is available in stream and it is default  &amp;nbsp;set the vtt track to diable status before playing stream.&lt;/p&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;div&gt;play stream  no subtitle is rendered along with A/V&lt;span class="Apple-tab-span" style="white-space:pre"&gt;   &lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;&amp;nbsp;&lt;/div&gt;]]&gt;&lt;/summary&gt;
      &lt;preconditions&gt;&lt;![CDATA[]]&gt;&lt;/preconditions&gt;
      &lt;execution_type&gt;&lt;![CDATA[1]]&gt;&lt;/execution_type&gt;
      &lt;importance&gt;&lt;![CDATA[2]]&gt;&lt;/importance&gt;
  &lt;/testcase&gt;
  </code></pre>
  
  <p>Here is my Python code:</p>
  
  <pre><code>class CaseHandler( xml.sax.ContentHandler ):
     def __init__(self):
        self.CurrentData = ""
        self.externalid = ""
        self.version = ""
        self.summary = ""
  
     def startElement(self, tag, attributes):
         self.CurrentData = tag
         if tag == "testcase":
             name = attributes["name"]
             outfile.write("\n" + name + " ,")
  
     def endElement(self, tag):
         if self.CurrentData == "externalid":
             outfile.write("OTV52-" + self.externalid + ",")
  
         elif self.CurrentData == "version":
             outfile.write("Version:  " + self.version + ",")
  
         elif self.CurrentData == "summary":
             outfile.write("Summary:  " + self.summary + ",")
  
     def characters(self, content):
        if self.CurrentData == "externalid":
           self.externalid = content
        elif self.CurrentData == "version":
           self.version = content
        elif self.CurrentData == "summary":
           self.summary = content
  
  if ( __name__ == "__main__"):
  
     parser = xml.sax.make_parser()
     parser.setFeature(xml.sax.handler.feature_namespaces, 0)
  
     Handler = CaseHandler()
     parser.setContentHandler( Handler )
  
     parser.parse("OTV52.xml")
  </code></pre>
  
  <p>The problem is that it does not return any of the information in the "summary" brackets.  The externalid and version data comes over fine.  But all that is returned from the "summary" bracket are the div brackets.</p>
  
  <p>I need it to return:</p>
  
  <p>"condition: single subtitle track is available in stream and it is default  &nbsp;set the vtt track to diable status before playing stream. play stream  no subtitle is rendered along with A/V"</p>