Código PHP:
<?php
class setEdit{
public $xmlId;
public function SetEditores($stringXml){
$xml= simplexml_load_string($stringXml);
foreach ($xml->tituloBibliograficas[0] as $ED){
$this->xmlId[] = $ED->id;
}
}
public function getId(){
return $this->xmlId;
}
}
$string = <<<XML
<xml>
<tituloBibliograficas>
<editor>
<id>1</id>
</editor>
<editor>
<id>2</id>
</editor>
<editor>
<id>3</id>
</editor>
</tituloBibliograficas>
</xml>
XML;
$xmlClass = new setEdit();
$xmlClass->SetEditores($string);
$id = $xmlClass->getId();
foreach($id as $ids){
echo "Id: ".$ids."<br />";
}
?>