purify($html); $dom_html = $document->createDocumentFragment(); $dom_html->appendXML($html); $dom_div = $document->createElement('div'); $dom_div->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'); $dom_div->appendChild($dom_html); $node->appendChild($dom_div); } } ?>