cvs: phpdoc-hu /reference/simplexml/functions simplexml-load-file.xml
| From: | Lajos Cseppent� | Date: | Fri, 09 Jun 2006 14:50:57 +0000 |
| Subject: | cvs: phpdoc-hu /reference/simplexml/functions simplexml-load-file.xml | ||
| Groups: | php.doc.hu | ||
| Request: | Send a blank email to doc-hu+get-1415@lists.php.net to get a copy of this message | ||
chappy Fri Jun 9 14:50:57 2006 UTC
Added files:
/phpdoc-hu/reference/simplexml/functions simplexml-load-file.xml
Log:
simplexml_load_file()
http://cvs.php.net/viewcvs.cgi/phpdoc-hu/reference/simplexml/functions/simplexml-load-file.xml?view=markup&rev=1.1
Index: phpdoc-hu/reference/simplexml/functions/simplexml-load-file.xml
+++ phpdoc-hu/reference/simplexml/functions/simplexml-load-file.xml
<?xml version="1.0" encoding="iso-8859-2"?>
<!-- $Revision: 1.1 $ -->
<refentry id='function.simplexml-load-file'>
<refnamediv>
<refname>simplexml_load_file</refname>
<refpurpose>
XML fájl értelmez, és betölt objektumba
</refpurpose>
</refnamediv>
<refsect1>
<title>Leírás</title>
<methodsynopsis>
<type>object</type><methodname>simplexml_load_file</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam
choice="opt"><type>string</type><parameter>class_name</parameter></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
Ez a függvény a <parameter>filename</parameter> paraméterben találhatókéri
helyes XML karakterláncot konvertálja objektum típusú (<type>object</type>)
<type>SimpleXMLElement</type> osztállyá, és ezzel tér vissza. Ha hiba lép
fel, a visszatérési érték &false;.
</para>
<para>
Használhatód az opcinális <parameter>class_name</parameter> paramétert,
így a <function>simplexml_load_string</function> függvény a megadott
típusú osztállyal tér vissza. Ennek az osztálynak a <type>SimpleXMLElement</type>
osztálynak kellene az utódja lennie.
</para>
<para>
PHP 5.1.0 és Libxml 2.6.0 óta te használhatod az <parameter>options</parameter>
patamétert, hogy megadd a <link linkend="libxml.constants">kiegészítõ Libxml
paramétereket</link>.
</para>
<para>
<note>
<para>
Libxml 2 nem védi le az URI karaktereit, tehát ha pl.: a
<literal>b&c</literal>-t akarot átadni
URI paraméterként, a <literal>simplexml_load_file(rawurlencode('http://example.com/?a=' .
urlencode('b&c')))</literal>-t
kell meghívnod. PHP 5.1.0 óta nem kell megcsinálnod ezt, mert a PHP megcsinálja neked.
</para>
</note>
<para>
<example>
<title>XML dokumentum értelmezése</title>
<programlisting role="php">
<![CDATA[
<?php
// A test.xml fájl tartalmazza az XML dokumentumot root elemmel
// és legalább egy másik elemmel /[root]/title.
if (file_exists('test.xml')) {
$xml = simplexml_load_file('test.xml');
var_dump($xml);
} else {
exit('Nem létezik: test.xml.');
}
?>
]]>
</programlisting>
<para>
Siker esetén a kód kimenete:
</para>
<screen>
<![CDATA[
SimpleXMLElement Object
(
[title] => Example Title
...
)
]]>
</screen>
<simpara>
Itt használhatod a <literal>$xml->title</literal>-t a
<literal>/[root]/title</literal> eléréséhez.
</simpara>
</example>
</para>
<para>
Lásd még: <function>simplexml_load_string</function>
</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:"../../../../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
-->