I got the solution by myself.
What I did is change $dom->loadXML($content_temp) to $dom->loadHTML($content_temp). Thant’s it!!!
Another way is use the same loadXML function call, but define the nbsp entity by using :
1. Define a variable doctype before $dom->loadXML($content_temp).
$doctype = ‘<?xml version=”1.0″ encoding=”UTF-8″?>’ .chr(10)
. ‘<!DOCTYPE root [<!ENTITY nbsp “ ”>]>’;
2. Call $dom->loadXML($content_temp).
Hope this will be helpful.