Re: SimpleXML strange behaviour.
| From: | Carlos Medina | Date: | Tue, 09 Sep 2008 18:19:32 +0000 |
| Subject: | Re: SimpleXML strange behaviour. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-279741@lists.php.net to get a copy of this message | ||
Mirco Soderi schrieb:
Do you know any reason why the following code does work $xmlOperazioni = simplexml_load_file($xmlFilename); foreach($xmlOperazioni->operazione as $operazione) { if($operazione['nome'] == $operazioneRichiesta) {it is too dificult to say without the XML file youre try to load. Regards Carlosrequire($operazione['php']); break;} } but the following does not $xmlOperazioni = simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_operazioni']); foreach($xmlOperazioni->operazione as $operazione) { if($operazione->nome == $operazioneRichiesta) {require($operazione->php); break;} } that is I MUST access childrens of the element <operazione> as if it was an array, while (in the same page) the following code does work $xmlViste = simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']); foreach($xmlViste->vista as $vista) {if($vista->nome == $nomeVistaDaMostrare) { $smarty->assign("intestazione","componenti/".$vista->intestazione); $smarty->assign("menu","componenti/".$vista->menu); $smarty->assign("contenuto", "componenti/".$vista->contenuto); $smarty->assign("pie_di_pagina", "componenti/".$vista->pie_di_pagina); break; }} but the following does not $xmlViste = simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']); foreach($xmlViste->vista as $vista) {if($vista['nome'] == $nomeVistaDaMostrare) { $smarty->assign("intestazione","componenti/".$vista['intestazione']); $smarty->assign("menu","componenti/".$vista['menu']); $smarty->assign("contenuto", "componenti/".$vista['contenuto']); $smarty->assign("pie_di_pagina", "componenti/".$vista['pie_di_pagina']); break; }} that is this time I MUST access the childrens of the element <operazione> as if it was an object? Hi,