title: How to get the text from child nodes if it is parents to other node in Scrapy using XPath
body: <p>I am facing a problem where I have to get the result from the child node which may or may not be parents to some other node using Xpath in scrapy. consider the case like</p>
  
  <pre><code>&lt;h1 class="main"&gt;
   &lt;span class="child"&gt;data&lt;/span&gt;
  &lt;/h1&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>&lt;h1 class="main"&gt;
  &lt;span class="child"&gt;
   &lt;span class="child2"&gt;data&lt;/span&gt;
  &lt;/span&gt;
  &lt;/h1&gt;
  </code></pre>
  
  <p>My solution was <code>response.xpath(".//h1[@class='main']/span/text()").extract()</code></p>