filter_dom_load
- Versions
- 7
filter_dom_load($text)
Parses an HTML snippet and returns it as a DOM object.
This function loads the body part of a partial (X)HTML document and returns a full DOMDocument object that represents this document. You can use filter_dom_serialize() to serialize this DOMDocument back to a XHTML snippet.
Parameters
$text The partial (X)HTML snippet to load. Invalid mark-up will be corrected on import.
Return value
A DOMDocument that represents the loaded (X)HTML snippet.
Code
modules/filter/filter.module, line 818
<?php
function filter_dom_load($text) {
// Ignore warnings during HTML soup loading.
$dom_document = @DOMDocument::loadHTML('<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>' . $text . '</body></html>');
return $dom_document;
}
?>Login or register to post comments 