title: how to obtain HTML-free contents for non-div tags
body: <p>I want to find the HTML-free content of all the tags <strong>except</strong> for tags inside <code>&lt;div id="nav"&gt;</code></p>
  
  <p>For example, with the following HTML:</p>
  
  <pre><code>&lt;div id="nav"&gt;
      &lt;h1&gt;Navigate!&lt;/h1&gt;
      &lt;nav role="navigation"&gt;
          &lt;h2 class="structural"&gt;Main navigation&lt;/h2&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="/about/"&gt;About&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
          &lt;/nav&gt;
  
          &lt;div id="inside_nav"&gt;
              &lt;ul&gt;    
                  &lt;li&gt;&lt;a href="/"&gt;inside_home&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="/about/"&gt;inside_About&lt;/a&gt;&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>div = soup1.find("div", id="nav")
  
  def match_only_non_divs(tag):
      return (tag.findParent("div").get('id') == div.get('id')) and tag.name != "div"
  
  print div.findAll(match_only_non_divs, text=True)
  </code></pre>
  
  <p>This code should output:</p>
  
  <pre><code>[u'\n', u'Navigate!', u'Main navigation',
  u'Home', u'About', u'\n']
  </code></pre>
  
  <p>BUT! it is actually outputting:</p>
  
  <pre><code>[u'\n', u'Navigate!', u'Main navigation',
  u'Home', u'About', u'\n',
  u'inside_home', u'inside_About', u'\n']
  </code></pre>
  
  <p>The code should not walk inside the inner div (id="inside_nav") but it is going inside that.
  Please help !!</p>