function HTML5::load
Load and parse an HTML file.
This will apply the HTML5 parser, which is tolerant of many varieties of HTML, including XHTML 1, HTML 4, and well-formed HTML 3. Note that in these cases, not all of the old data will be preserved. For example, XHTML's XML declaration will be removed.
The rules governing parsing are set out in the HTML 5 spec.
Parameters
string|resource $file The path to the file to parse. If this is a resource, it is: assumed to be an open stream whose pointer is set to the first byte of input.
array $options Configuration options when parsing the HTML.:
Return value
\DOMDocument A DOM document. These object type is defined by the libxml library, and should have been included with your version of PHP.
1 call to HTML5::load()
- HTML5::loadHTMLFile in vendor/
masterminds/ html5/ src/ HTML5.php - Convenience function to load an HTML file.
File
-
vendor/
masterminds/ html5/ src/ HTML5.php, line 65
Class
- HTML5
- This class offers convenience methods for parsing and serializing HTML5. It is roughly designed to mirror the \DOMDocument native class.
Namespace
MastermindsCode
public function load($file, array $options = array()) {
// Handle the case where file is a resource.
if (is_resource($file)) {
return $this->parse(stream_get_contents($file), $options);
}
return $this->parse(file_get_contents($file), $options);
}