<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.libxml-use-internal-errors" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>libxml_use_internal_errors</refname>
  <refpurpose>
   Disable libxml errors and allow user to fetch error information as needed
  </refpurpose>
 </refnamediv>
 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>libxml_use_internal_errors</methodname>
   <methodparam choice="opt"><type class="union"><type>bool</type><type>null</type></type><parameter>use_errors</parameter><initializer>&null;</initializer></methodparam>
  </methodsynopsis>
  <para>
   <function>libxml_use_internal_errors</function> allows you to disable
   standard libxml errors and enable user error handling.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>use_errors</parameter></term>
      <listitem>
       <para>
        Enable (&true;) user error handling or disable (&false;) user error handling. Disabling will also clear any existing libxml errors.
       </para>
      </listitem>
     </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   This function returns the previous value of
   <parameter>use_errors</parameter>.
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <informaltable>
   <tgroup cols="2">
    <thead>
     <row>
      <entry>&Version;</entry>
      <entry>&Description;</entry>
     </row>
    </thead>
    <tbody>
     <row>
      <entry>8.0.0</entry>
      <entry>
       <parameter>use_errors</parameter> is nullable now. Previously, its default
       was &false;.
      </entry>
     </row>
    </tbody>
   </tgroup>
  </informaltable>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
    <title>A <function>libxml_use_internal_errors</function> example</title>
    <para>
     This example demonstrates the basic usage of libxml errors and the value
     returned by this function.
    </para>
    <programlisting role="php">
<![CDATA[
<?php

// enable user error handling
var_dump(libxml_use_internal_errors(true));

// load the document
$doc = new DOMDocument;

if (!$doc->load('file.xml')) {
    foreach (libxml_get_errors() as $error) {
        // handle errors here
    }

    libxml_clear_errors();
}

?>
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
bool(false)
]]>
    </screen>
   </example>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>libxml_clear_errors</function></member>
    <member><function>libxml_get_errors</function></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
-->
