title: Reading XML binary data with BeautifulSoup
body: <p>Good day,</p>
  
  <p>I am using BeautifulSoup to parse an XML file which has a tag like the sample below which contains some binary data:</p>
  
  <pre><code>&lt;data length=1234 encoding="x-modified"&gt;
  :M\ANEG9&amp;3I6%1I8CN!68&lt;ID(E]*%N]Y/J;:6EYM6&amp;N:9&lt;E9).YA*I:94*]9O.[Y
  R;59Z0LEWY;74*:E!5YWM8KE[AE;48:5N"I74*:H(E#L79X57ZG1'E:85=YVE68,
  :3=5=:B&amp;FVN-Y(EU;UJ:*28FSQ#F6,ID'V:EE-JVN=APE:9X&amp;8EYFL&lt;67TI$DBR0
  ........
  &lt;/data&gt;
  </code></pre>
  
  <p>The tag, attributes and binary data is read all wrong as below:</p>
  
  <pre><code>&lt;data&gt;1234 encoding="x-modified"&amp;gt;
  :M\ANEG93I6%1I8CN!68&lt;ID&gt;(E]*%N]Y/J;:6EYM6&lt;E9&gt;).YA*I:94*]9O.[Y
  R;59Z0LEWY;74*:E!5YWM8KE[AE;48:5N"I74*:H(E#L79X57ZG1'E:85=YVE68,
  :3=5=:B(EU;UJ:*28FSQ#F6,ID'V:EE-JVN=APE:9X8EYFL&lt;/E9&gt;&lt;/ID&gt;&lt;/data&gt;
  </code></pre>
  
  <p>Note how the data is truncated when a '&lt;' is encountered in the data. Also note that the attribute 'length' is removed when the tag is read.</p>
  
  <p>Any ideas how I can work around this are appreciated.</p>
  
  <p>Thank you.</p>