Reputation: 3301
HTML structure looks like this:
<div class="Parent">
<div id="A">more tags and text</div>
<div id="B">more tags and text</div>
more tags
<p> and text </p>
</div>
I would like to extract text just from the parent and the tags apart from the A and B children. I have tried /div[@class='Parent']//text()
which extracts text from all the descendant nodes, so a made a constraint like /div[@class='Parent']//text()[not(self::div)]
but it did not change a thing.
Thanks for any advice
Upvotes: 0
Views: 1737
Reputation: 4440
/div[@class='Parent']/*[not(self::div and (@id='A' or @id='B'))]//text() | /div[@class='Parent']/text()
Upvotes: 1