XPATH - Extract content between two positions with different indent (python) <p>I'm trying to get some data from an HTML file via url. Here's an example:</p> <pre><code>&lt;html&gt; ... &lt;div class="start"&gt; &lt;!-- Everything from here.. --&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=''&gt;&lt;/a&gt; &lt;span&gt;&lt;/span &lt;br&gt; &lt;!-- ..to here --&gt; &lt;div class="end"&gt; ... &lt;/div&gt; ... ... &lt;/div&gt; ... &lt;/html&gt; </code></pre> <p>I'm trying to the the data that is directly under <code>div class="start"</code>, but I don't know how, since the div contains almost the whole page. What I do know, is that <code>div class="end"</code> comes right after the data I want. Keep in mind that I don't want only the text in between, but the different elements, which in this case i <code>&lt;p&gt; &amp; &lt;span&gt; &amp; &lt;a&gt;</code>. Also note that the element types may vary from what is showing in the HTML above.</p> <p>Google gave me different types of this (without any luck): <code>'//*[preceding-sibling::div[@class="start"] and following-sibling::div[@class="end"]]'</code></p>