downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

SimpleXMLIterator::hasChildren> <SimpleXMLIterator::current
[edit] Last updated: Fri, 07 Jun 2013

view this page in

SimpleXMLIterator::getChildren

(PHP 5 >= 5.1.0)

SimpleXMLIterator::getChildrenDevuelve los sub elementos de el elemento actual

Descripción

SimpleXMLIterator SimpleXMLIterator::getChildren ( void )

Este método devuelve un objeto SimpleXMLIterator que contiene sub elementos de el elemento SimpleXMLIterator actual.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

Devuelve un objeto SimpleXMLIterator que contiene los sub elementos de el elemento actual.

Ejemplos

Ejemplo #1 Devuelve los sub elementos de el elemento actual

<?php
$xml 
= <<<XML
<books>
    <book>
        <title>PHP Básico</title>
        <author>Jim Smith</author>
    </book>
    <book>XML básico</book>
</books>
XML;

$xmlIterator = new SimpleXMLIterator($xml);
for( 
$xmlIterator->rewind(); $xmlIterator->valid(); $xmlIterator->next() ) {
    foreach(
$xmlIterator->getChildren() as $name => $data) {
    echo 
"El $name es '$data' de la clase " get_class($data) . "\n";
    }
}
?>

El resultado del ejemplo sería:

El título es 'PHP Básico' de la clase SimpleXMLIterator
El autor es 'Jim Smith' de la clase SimpleXMLIterator



add a note add a note User Contributed Notes SimpleXMLIterator::getChildren - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites