mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-04-27 18:53:21 +02:00
f5c7546101
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@166904 c90b9560-bf6c-de11-be94-00142212c4b1
83 lines
2.1 KiB
XML
83 lines
2.1 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.6 $ -->
|
|
<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready -->
|
|
<refentry id='function.simplexml-element-children'>
|
|
<refnamediv>
|
|
<refname>SimpleXMLElement->children</refname>
|
|
<refpurpose>Trouve les enfants d'une node</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>object SimpleXMLElement</type><methodname>simplexml_element->children</methodname>
|
|
<void/>
|
|
</methodsynopsis>
|
|
<para>
|
|
Cette méthode trouve le fils de l'élément dont il est membre. Le résultat
|
|
suit les règles normales d'itération.
|
|
</para>
|
|
&simplexml.iteration;
|
|
<example>
|
|
<title>Traverser un pseudo-tableau <literal>children()</literal></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$xml = simplexml_load_string(
|
|
'<person>
|
|
<child role="son">
|
|
<child role="daughter"/>
|
|
</child>
|
|
<child role="daughter">
|
|
<child role="son">
|
|
<child role="son"/>
|
|
</child>
|
|
</child>
|
|
</person>');
|
|
|
|
foreach ($xml->children() as $second_gen) {
|
|
echo ' The person begot a ' . $second_gen['role'];
|
|
|
|
foreach ($second_gen->children() as $third_gen) {
|
|
echo ' who begot a ' . $third_gen['role'] . ';';
|
|
|
|
foreach ($third_gen->children() as $fourth_gen) {
|
|
echo ' and that ' . $third_gen['role'] .
|
|
' begot a ' . $fourth_gen['role'];
|
|
}
|
|
}
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
The person begot a son who begot a daughter; The person
|
|
begot a daughter who begot a son; and that son begot a son
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</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
|
|
-->
|