Re: importing from XML-files

From: Date: Thu, 22 Jan 2009 16:00:38 +0000
Subject: Re: importing from XML-files
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-287012@lists.php.net to get a copy of this message
Merlin Morgenstern schrieb:
Carlos Medina wrote:
Merlin Morgenstern schrieb:
Hi everybody, I am creating an import script which is getting data out of an xml file. Now I do have a problem with a file where 2 images are included. I need to access the second image name, but can not find out how. I do: $xml = simplexml_load_file($files[$i]); $data[pic1_base64] = $xml->anbieter->anhang->anhanginhalt; This get's me the first image in line. But how could I get the second one? Thank you for any help, Merlin
Hi Merlin, well please tell us how shows the XML DOC?. I can see that the XML read a node like anbieter. Is the Anhang an Object or Array? Is this Empty? viele Gruesse Carlos Medina
Hello Carlos, the xml structure looks like this: ----------------- <anhaenge> <anhang location="EXTERN" gruppe="TITELBILD"> <anhangtitel>Ansicht_Strassenseite</anhangtitel> <format>jpg</format> <daten> <pfad>_1006-kurz_ansicht_strassenseite.jpg</pfad> </daten> </anhang> <anhang location="EXTERN" gruppe="GRUNDRISS"> <anhangtitel>Grundriss_Modern-kuehl</anhangtitel> <format>jpg</format> <daten> <pfad>_1006-lang2_grundriss_modern-kuehl.jpg</pfad> </daten> </anhang> </anhaenge> ------------------ Thank you for your help, Merlin Hi Merlin,
what about? foreach( $xml->anbieter->anhang as $data ){
     echo $data->anhangtitel . '<br>';
} regards Carlos Medina

« previous php.general (#287012) next »