title: Use lxml to parse text file with bad header in Python
body: <p>I would like to parse text files (stored locally) with lxml's etree. But all of my files (thousands) have headers, such as:</p>
  
  <pre><code>-----BEGIN PRIVACY-ENHANCED MESSAGE-----
  Proc-Type: 2001,MIC-CLEAR
  Originator-Name: webmaster@www.sec.gov
  Originator-Key-Asymmetric:
   MFgwCgYEVQgBAQICAf8DSgAwRwJAW2sNKK9AVtBzYZmr6aGjlWyK3XmZv3dTINen
   TWSM7vrzLADbmYQaionwg5sDW3P6oaM5D3tdezXMm7z1T+B+twIDAQAB
  MIC-Info: RSA-MD5,RSA,
   AHxm/u6lqdt8X6gebNqy9afC2kLXg+GVIOlG/Vrrw/dTCPGwM15+hT6AZMfDSvFZ
   YVPEaPjyiqB4rV/GS2lj6A==
  
  &lt;SEC-DOCUMENT&gt;0001193125-07-200376.txt : 20070913
  &lt;SEC-HEADER&gt;0001193125-07-200376.hdr.sgml : 20070913
  &lt;ACCEPTANCE-DATETIME&gt;20070913115715
  ACCESSION NUMBER:       0001193125-07-200376
  CONFORMED SUBMISSION TYPE:  10-K
  PUBLIC DOCUMENT COUNT:      7
  CONFORMED PERIOD OF REPORT: 20070630
  FILED AS OF DATE:       20070913
  DATE AS OF CHANGE:      20070913
  </code></pre>
  
  <p>and the first <code>&lt;</code> isn't until line 51 in this case (and isn't 51 in all cases). The xml portions starts as follows:</p>
  
  <pre><code>&lt;/SEC-HEADER&gt;
  &lt;DOCUMENT&gt;
  &lt;TYPE&gt;10-K
  &lt;SEQUENCE&gt;1
  &lt;FILENAME&gt;d10k.htm
  &lt;DESCRIPTION&gt;FORM 10-K
  &lt;TEXT&gt;
  &lt;HTML&gt;&lt;HEAD&gt;
  &lt;TITLE&gt;Form 10-K&lt;/TITLE&gt;
  &lt;/HEAD&gt;
   &lt;BODY BGCOLOR="WHITE"&gt;
  &lt;h5 align="left"&gt;&lt;a href="#toc"&gt;Table of Contents&lt;/a&gt;&lt;/h5&gt;
  </code></pre>
  
  <p>Can I handle this on-the-fly with lxml? Or should I use a stream editor to omit each file's header? Thanks!</p>
  
  <p>Here is my current code and error.</p>
  
  <pre><code>from lxml import etree
  f = etree.parse('temp.txt')
  
  XMLSyntaxError: Start tag expected, '&lt;' not found, line 1, column 1
  </code></pre>
  
  <p>Edit:</p>
  
  <p>FWIW, here is a link to the <a href="http://www.sec.gov/Archives/edgar/data/1006830/000119312507200376/0001193125-07-200376.txt" rel="noreferrer">file</a>.</p>