title: BeautifulSoup remove tag attributes and text contents
body: <p>I want to compare some webpages based on their overall DOM structure but not their particular contents. To this end i need a representation that resembles the tag hierachy but does not include attributes or textual tag-contents. </p>
  
  <p>Basically, I want to turn a representation like this</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;h1 id="peter"&gt;My First Heading&lt;/h1&gt;
  &lt;p&gt;&lt;span style="color:red"&gt;My&lt;/span&gt; first paragraph.&lt;/p&gt;
  
  &lt;img src="peter.jpg" /&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>into a canoncial baremetal representation like this:</p>
  
  <p><code>&lt;html&gt;&lt;body&gt;&lt;h1&gt;&lt;/h1&gt;&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;img/&gt;&lt;/body&gt;&lt;/html&gt;</code></p>
  
  <p>i.e. all attributes removed, as well as tag contents that are not other tags.</p>
  
  <p>I found a way to remove attributes from tags, but im having problems differentiation between text child nodes and tag child nodes.</p>