title: How to handle an empty HTML element without the ending slash?
body: <p>I try to convert an HTML page into a tree structure. I have derived this class (I removed what I actually do with each tag as it's not relevant) :</p>
  
  <pre><code>class PageParser(html.parser.HTMLParser):
      def handle_starttag(self, tag, attrs):
          print("start "+tag)
      def handle_endtag(self, tag):
          print("end "+tag)
      def handle_startendtag(self, tag, attrs):
          print("startend "+tag)
  </code></pre>
  
  <p>I expected empty elements to trigger the <code>handle_startendtag</code> method. The problem is that, when encountering an empty element like <code>&lt;meta&gt;</code>, only the <code>handle_starttag</code> method is called. The tag is never closed from my class' point of view :</p>
  
  <pre><code>parser = PageParser()
  parser.feed('&lt;div&gt; &lt;meta charset="utf-8"&gt; &lt;/div&gt;')
  </code></pre>
  
  <p>prints :</p>
  
  <pre><code>start div
  start meta
  end div
  </code></pre>
  
  <p>I need to know when each element has been closed to correctly create the tree. How can I know if a tag is an empty element ?</p>