I am trying to extract the text from the below html structure using xpath, The xpath expression i am using is
'//div[@class="descr_id"]/descendant-or-self::*/text()'
But the array I get from above, does change the order of the text, it first gives me all the descendant and then self text while I plan to exactly get all the text in below kind of html structure in the same order like "This text 1 This text 2 This text 3.........".
<div class="descr_id">
This text 1
<a href="www.example.com">This text 2</a>
This text 3
<a href="www.example2.com">This text 4</a>
This text main 5
<ul>
<li>
This text 6</li>
<li>
This text 7</li>
</ul>
</div>