Xpath to extract text between specific div tag and next div
问题 I want to extract text in <p> between the div tag 'Heading1' and the next div tag, in the example below. I can't used 'heading2 to isolate the next div as this text may change. library(XML) # create example html html <- ' <div class="AAA"> <div class="AAA">Heading1</div> </div> <p>text1 I want</p> <p>text2 I want</p> <p>text3 I want</p> <div class="AAA"> <div class="AAA">Heading2</div> <!-- Do not always know what this heading is --> </div> <p>more text</p> <p>more text</p> <p>more text</p>