<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="domdocument.loadhtmlfile" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>DOMDocument::loadHTMLFile</refname>
  <refpurpose>
   Load HTML from a file
  </refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="DOMDocument">
   <modifier>public</modifier> <type>bool</type><methodname>DOMDocument::loadHTMLFile</methodname>
   <methodparam><type>string</type><parameter>filename</parameter></methodparam>
   <methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
  </methodsynopsis>
  <para>
   The function parses the HTML document in the file named
   <parameter>filename</parameter>. Unlike loading XML, HTML does not have
   to be well-formed to load.
  </para>
  <warning>
   <para>
    This function parses the input using an HTML 4 parser. The parsing rules
    of HTML 5, which is what modern web browsers use, are different. Depending
    on the input this might result in a different DOM structure. Therefore
    this function cannot be safely used for sanitizing HTML.
   </para>
   <para>
    As an example, some HTML elements will implicitly close a parent element
    when encountered. The rules for automatically closing parent elements
    differ between HTML 4 and HTML 5 and thus the resulting DOM structure that
    <classname>DOMDocument</classname> sees might be different from the DOM
    structure a web browser sees, possibly allowing an attacker to break the
    resulting HTML.
   </para>
  </warning>
 </refsect1>
 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>filename</parameter></term>
     <listitem>
      <para>
       The path to the HTML file.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>options</parameter></term>
     <listitem>
      &dom.parameter.options;
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>
 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &return.success;
  </para>
 </refsect1>
 <refsect1 role="errors">
  &reftitle.errors;
  <para>
   If an empty string is passed as the <parameter>filename</parameter>
   or an empty file is named, a warning will be generated. This warning
   is not generated by libxml and cannot be handled using <link linkend="function.libxml-use-internal-errors">libxml's error handling
   functions</link>.
  </para>
  &dom.malformederror;
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <informaltable>
   <tgroup cols="2">
    <thead>
     <row>
      <entry>&Version;</entry>
      <entry>&Description;</entry>
     </row>
    </thead>
    <tbody>
     <row>
      <entry>8.3.0</entry>
      <entry>
       This function now has a tentative <type>bool</type> return type.
      </entry>
     </row>
     <row>
      <entry>8.0.0</entry>
      <entry>
       Calling this function statically will
       now throw an <classname>Error</classname>.
       Previously, an <constant>E_DEPRECATED</constant> was raised.
      </entry>
     </row>
    </tbody>
   </tgroup>
  </informaltable>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>Creating a Document</title>
    <programlisting role="php">
<![CDATA[
<?php
$doc = new DOMDocument();
$doc->loadHTMLFile("filename.html");
echo $doc->saveHTML();
?>
]]>
    </programlisting>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><methodname>DOMDocument::loadHTML</methodname></member>
    <member><methodname>DOMDocument::saveHTML</methodname></member>
    <member><methodname>DOMDocument::saveHTMLFile</methodname></member>
   </simplelist>
  </para>
 </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
