Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/01/2008, 11:15
Avatar de Jesica
Jesica
 
Fecha de Ingreso: agosto-2007
Mensajes: 78
Antigüedad: 16 años, 9 meses
Puntos: 0
recorrer xml con simpleXml

Hola gente, quiero recorrer esta lista de editores para obtener el id:
<xml><tituloBibliograficas>
<editor>
<id>1</id>
</editor>
<editor>
<id>2</id>
</editor>
<editor>
<id>3</id>
</editor>
</tituloBibliograficas></xml>

Lo hago de la siguiente manera, pero no funciona…

Código PHP:
function SetEditores($stringXml)
    {
        
$xmlsimplexml_load_string($stringXml);
        foreach (
$xml->tituloBibliograficas[0]->editor as $ED)
        {
            
$editor= new editor();
            
$editor->setId($ED->id);
            
$this->listaEditores->attach($editor);
        }

    } 
Donde esta el error?
Desde ya muchas gracias