1
0
mirror of https://github.com/php/doc-tr.git synced 2026-03-24 15:22:23 +01:00
Files
archived-doc-tr/reference/libxml/functions/libxml-get-errors.xml
2021-06-07 18:41:48 +03:00

147 lines
3.4 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: fed3682684f1af372dc9a7f15d0468e5a884ab16 Maintainer: nilgun Status: ready -->
<refentry xml:id="function.libxml-get-errors" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>libxml_get_errors</refname>
<refpurpose>Hataları içeren bir dizi döndürür</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>array</type><methodname>libxml_get_errors</methodname>
<void/>
</methodsynopsis>
<para>
Hataları içeren bir dizi döndürür.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Tamponda bir hata oluşmuşsa <type>LibXMLError</type> nesnelerinden oluşan
bir dizi, yoksa boş bir dizi döner.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>- <function>libxml_get_errors</function> örneği</title>
<para>
Örnekte basit bir libxml hata eylemcisinin gerçeklenişi gösterilmiştir.
</para>
<programlisting role="php">
<![CDATA[
<?php
libxml_use_internal_errors(true);
$xmlstr = <<< XML
<?xml version='1.0' standalone='yes'?>
<movies>
<movie>
<titles>PHP: Behind the Parser</title>
</movie>
</movies>
XML;
$doc = simplexml_load_string($xmlstr);
$xml = explode("\n", $xmlstr);
if ($doc === false) {
$errors = libxml_get_errors();
foreach ($errors as $error) {
echo display_xml_error($error, $xml);
}
libxml_clear_errors();
}
function display_xml_error($error, $xml)
{
$return = $xml[$error->line - 1] . "\n";
$return .= str_repeat('-', $error->column) . "^\n";
switch ($error->level) {
case LIBXML_ERR_WARNING:
$return .= "Uyarı $error->code: ";
break;
case LIBXML_ERR_ERROR:
$return .= "Hata $error->code: ";
break;
case LIBXML_ERR_FATAL:
$return .= "Ölümcül hata $error->code: ";
break;
}
$return .= trim($error->message) .
"\n Satır: $error->line" .
"\n Sütun: $error->column";
if ($error->file) {
$return .= "\n Dosya: $error->file";
}
return "$return\n\n--------------------------------------------\n\n";
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
<titles>PHP: Behind the Parser</title>
----------------------------------------------^
Ölümcül hata 76: Opening and ending tag mismatch: titles line 4 and title
Satır: 4
Sütun: 46
--------------------------------------------
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>libxml_get_last_error</function></member>
<member><function>libxml_clear_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
-->