title: beautifulsoup and invalid html document
body: <p>I am trying to parse the document <a href="http://www.consilium.europa.eu/uedocs/cms_data/docs/pressdata/en/ecofin/acf8e.htm" rel="nofollow noreferrer">http://www.consilium.europa.eu/uedocs/cms_data/docs/pressdata/en/ecofin/acf8e.htm</a>.
  I want to get countries and names at the beginning of the document.</p>
  
  <p>Here is my code</p>
  
  <pre><code>import urllib
  import re
  from bs4 import BeautifulSoup
  url="http://www.consilium.europa.eu/uedocs/cms_data/docs/pressdata/en/ecofin/acf8e.htm"
  soup=BeautifulSoup(urllib.urlopen(url))
  attendances_table=soup.find("table", {"width":850})
  print attendances_table #this works, I see the whole table
  print attendances_table.find_all("tr")
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>AttributeError: 'NoneType' object has no attribute 'next_element'
  </code></pre>
  
  <p>I then tried to use the same solution as in this post (I know, again, me :p) :
  <a href="https://stackoverflow.com/questions/23347376/beautifulsoup-with-an-invalid-html-document">beautifulsoup with an invalid html document</a></p>
  
  <p>I replaced the line:</p>
  
  <pre><code>soup=BeautifulSoup(urllib.urlopen(url))
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>return BeautifulSoup(html, 'html.parser')
  </code></pre>
  
  <p>Now if I do:</p>
  
  <pre><code>print attendances_table
  </code></pre>
  
  <p>I only get:</p>
  
  <pre><code>&lt;table border="0" cellpadding="10" cellspacing="0" width="850"&gt;
  &lt;tr&gt;&lt;td valign="TOP" width="42%"&gt;
  &lt;p&gt;&lt;b&gt;&lt;u&gt;Belgium&lt;/u&gt;&lt;/b&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
  </code></pre>
  
  <p>What should I change?</p>