I've the following HTML code with a custom tag <gcse:search>
. It's from "Custom Google Search Engine" to embed in a page.
However, after parsing via PHP DOMDocument, <gcse:search>
gets converted to <search
> breaking the functionality.
<?php
$html = <<<EOD
<!DOCTYPE html>
<html>
<body>
<gcse:search enablehistory="false"></gcse:search>
</body>
</html>
EOD;
libxml_use_internal_errors(true);
$dom = new DOMDocument();
$dom->loadHTML($html);
echo $dom->saveHTML();
Output:
<!DOCTYPE html>
<html>
<body>
<search enablehistory="false"></search>
</body>
</html>