I am trying to scrappe for this page

I am using xPath to select this, my code is ..
$safeFlag = true ;
//*[@id="tabset_productPage"]/dd[1]/div/div //HAVE TRIED THIS TOO
//*[@id="tabset_productPage"]/dd[1]/div/div // HAVE TRIED THIS
$safety_query='//*[@id="tabset_productPage"]/dd[1]/div/div/text()';
$safety = $xpath->query($description_query);
foreach ($safety as $word1) {
$safety_warning[]=(trim($word1->nodeValue));
if($safety_warning != ''){
$safeFlag = false ;
$safety_warning[]= 'NO SAFETY WARNING..';
}
}
var_dump($safety_warning);
and for description text, I use xPath like
//*[@id="tabset_productPage"]/dd[1]
but issue is, using all of this, I get both safetywarning and description completely..
My issue is, I want to select SAFETY WARNING and DESCRIPTION texts separately, but I always get them as a whole, complete text including safety warning and description ,for all of the xPath above..
Also, html structure is not always same..description at some time can have <br> or <p> tags placed so,
can somebody guide me? some suggestion or out line how can I achieve this? how can put safety warning / description in saparate columns / variables while both are child of same element..
thanks..
The safety warning is the first text child node of
//dl[@id="tabset_productPage"]/dd[1]/. To exclude it from selection you can select all text nodes with a position greater than 1. The query to obtain the description would look like:I’ve prepared an example to test it. Here it comes: