php-doc-en/reference/simplexml/functions/simplexml-element-children.xml
Rudy Nappée 685a03b4b3 * No () in refnames
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@263467 c90b9560-bf6c-de11-be94-00142212c4b1
2008-07-24 21:54:47 +00:00

146 lines
3.3 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.14 $ -->
<refentry xml:id='function.simplexml-element-children' xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>SimpleXMLElement->children</refname>
<refpurpose>Finds children of given node</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<classsynopsis>
<ooclass><classname>SimpleXMLElement</classname></ooclass>
<methodsynopsis>
<type>SimpleXMLElement</type><methodname>children</methodname>
<methodparam choice="opt"><type>string</type><parameter>ns</parameter></methodparam>
<methodparam choice="opt"><type>bool</type><parameter>is_prefix</parameter></methodparam>
</methodsynopsis>
</classsynopsis>
<para>
This method finds the children of the element of which it is a member. The result
follows normal iteration rules.
</para>
&simplexml.iteration;
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>ns</parameter></term>
<listitem>
<para>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>is_prefix</parameter></term>
<listitem>
<para>
Default to &false;
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>5.2.0</entry>
<entry>
The optional parameter <parameter>is_prefix</parameter> was added.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Traversing a <literal>children()</literal> pseudo-array</title>
<programlisting role="php">
<![CDATA[
<?php
$xml = new SimpleXMLElement(
'<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>
</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
-->