title: xpath select node texts and child nodes
body: <p>I am using python scrapy to scrape some data from a website.</p>
  
  <p>the web site content is something like this</p>
  
  <pre><code> &lt;html&gt;
    &lt;div class="details"&gt;
    &lt;div class="a"&gt; not needed&lt;/div&gt;
    content 1
    &lt;p&gt;content 2&lt;/p&gt;
    &lt;div&gt;content 2&lt;/div&gt;
    &lt;p&gt;content 2&lt;/p&gt;
    &lt;div&gt;content 2&lt;/div&gt;
    &lt;p&gt;content 2&lt;/p&gt;
    &lt;div class="b"&gt; this is also not needed&lt;/div&gt;
    &lt;/div&gt;
   &lt;/html&gt;
  </code></pre>
  
  <p>I need to get the full html data excluding div with class a,b.</p>
  
  <p>so my output will be like this</p>
  
  <pre><code>&lt;div class="details"&gt;   
  content 1
  &lt;p&gt;content 2&lt;/p&gt;
  &lt;div&gt;content 2&lt;/div&gt;
  &lt;p&gt;content 2&lt;/p&gt;
  &lt;div&gt;content 2&lt;/div&gt;
  &lt;p&gt;content 2&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How can I write correct xpath for that or should I write xpath for div with class 'details','a','b 'and use string operations to remove div with class 'a','b'?</p>
  
  <p>Note that here content   is the text of and is not a child of div with class 'details' </p>