title: Beautifulsoup sibling structure with br tags
body: <p>I'm trying to parse a HTML document using the BeautifulSoup Python library, but the structure is getting distorted by <code>&lt;br&gt;</code> tags. Let me just give you an example.</p>
  
  <p>Input HTML:</p>
  
  <pre><code>&lt;div&gt;
    some text &lt;br&gt;
    &lt;span&gt; some more text &lt;/span&gt; &lt;br&gt;
    &lt;span&gt; and more text &lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>HTML that BeautifulSoup interprets:</p>
  
  <pre><code>&lt;div&gt;
    some text
    &lt;br&gt;
      &lt;span&gt; some more text &lt;/span&gt;
      &lt;br&gt;
        &lt;span&gt; and more text &lt;/span&gt;
      &lt;/br&gt;
    &lt;/br&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In the source, the spans could be considered siblings. After parsing (using the default parser), the spans are suddenly no longer siblings, as the br tags became part of the structure.</p>
  
  <p>The solution I can think of to solve this is to strip the <code>&lt;br&gt;</code> tags altogether, before pouring the html into Beautifulsoup, but that doesn't seem very elegant, as it requires me to change the input. What's a better way to solve this?</p>