Re: Generate XHTML (HTML compatible) Code using DOMDocument
| From: | Raymond Irving | Date: | Sun, 12 Apr 2009 17:16:49 +0000 |
| Subject: | Re: Generate XHTML (HTML compatible) Code using DOMDocument | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-291391@lists.php.net to get a copy of this message | ||
It appears that the email system stripped out the "& #13;" from this line:
$html = str_replace(' ','',$html);
Best regards,
__
Raymond Irving
--- On Sun, 4/12/09, Raymond Irving <xwisdom@yahoo.com> wrote:
> From: Raymond Irving <xwisdom@yahoo.com>
> Subject: [PHP] Generate XHTML (HTML compatible) Code using DOMDocument
> To: "php-general@lists.php.net" <php-general@lists.php.net>
> Date: Sunday, April 12, 2009, 11:07 AM
>
> Hello,
>
> After talking with Michael about how to generate XHTML code
> using the DOM I came up with this little function that I'm
> thinking of using to generate XHTML code that's HTML
> compatible:
>
> function saveXHTML($dom) {
> $html =
> $dom->saveXML(null,LIBXML_NOEMPTYTAG);
> $html = str_replace('
','',$html);
> $html =
> preg_replace('/<\?xml[^>]*>\n/','',$html,1);
> $html =
>
> preg_replace('/<\!\[CDATA\[(.*)\]\]><\/script>/s','//<![CDATA[\1//]]></script>',$html);
> $html =
>
> preg_replace('/><\/(meta|link|base|basefont|param|img|br|hr|area|input)>/','
> />',$html);
> return $html;
> }
>
> What do you think?
>
>
> __
> Raymond Irving
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>