I take the server response using xml, xsl and extract the necessary fragments in order to extract the html fragments from the server response to client requrest. For example, suppose $ content has a server response before we process it.
$dom = new domDocument(); $dom->loadXML($content); $xslProgram = <<<xslProgram <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'> <xsl:output method="html" encoding='UTF-8' indent="yes" /> <xsl:template match="/"> <xsl:copy-of select="$select" /> </xsl:template> </xsl:stylesheet> xslProgram; $domXsl = new domDocument(); $domXsl->loadXML($xslProgram); $xsl = new XSLTProcessor(); $xsl->importStylesheet($domXsl); $content = $xsl->transformToXml($dom);
Everything seems to work correctly, but when it detects & nbsp, & laquo, & raquo, etc., the message "Warning: DOMDocument :: loadXML () [function.DOMDocument-loadXML]: Object 'laquo', not defined in Entity "
At first, I simply replaced all of these elements (& nbsp and others) with their unicode equivalents (str_replace), but then I understand that I cannot consider all of these options. How can I solve this problem?
Let me know if you did not make out, I can write a better explanation.
Thank you, Achmed.
Ahmed source share