In my code, I have
$document = DomDocument->loadHTML($someHTML); $xPath = new DOMXPath($document); // //do some xpath query and processing // $result = $d
$someHTML = str_replace (' ', '@nbsp;', $someHTML); $document = DomDocument->loadHTML($someHTML); $xPath = new DOMXPath($document); // //do some xpath query and processing // $result = $document->saveHTML(); $result = str_replace ('@nbsp;', ' ', $result);