Answer the question
In order to leave comments, you need to log in
How to parse content that is between two divs?
Hello, can you please tell me how to parse the content between two divs using the "Php simple html dom parser" parser?
For example, there is such a layout:
<div class="start">Текст</div> <!-- Начало парсинга с этого дива -->
<p>Первый контент</p>
<p>Второй контент</p>
<p>Третий контент</p>
<div class="end">Текст</div> <!-- и до этого дива -->
Answer the question
In order to leave comments, you need to log in
XPath decides:
But if it is not necessary to capture the start / end divs, then the task is greatly simplified:
//*[preceding-sibling::div[@class="start"] and following-sibling::div[@class="end"]]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question