Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/08/2014, 14:36
RALlave
 
Fecha de Ingreso: noviembre-2008
Mensajes: 62
Antigüedad: 15 años, 5 meses
Puntos: 2
Leer un XML con tag similares

Hola amigos del FDW.
Ojala me ayuden con esto:
tengo un xml como la que pongo abajo y lo estoy leyendo con este codigo
Código PHP:
$fxml=file_get_contents("http://midominio.com/filexml.xml");
                   
$xml = new SimpleXMLElement($fxml);
                
foreach (
$xml->schedule->movie as $movie){
 echo 
$movie->movie_id;
 echo 
$movie->movie_no;

hasta ahi sin problemas, pero.... como hago para extraer lo que esta dentro <showtiemes> ???

esto no me sirvio
Código PHP:
foreach ($xml->schedule->movie->showtimes->showtime as $st){
 echo 
$st;

De antemano Graciass!!!
Código HTML:
<schedule>
                <movie>
                    <movie_id>104908</movie_id>
                    <movie_name>Fort McCoy</movie_name>
                    <movie_rating>R</movie_rating>
                    <showtimes attributes="" sound="" allowpasses="Yes" comments="">
                        <showtime>13:50</showtime>
                        <showtime>16:30</showtime>
                        <showtime>19:10</showtime>
                        <showtime>21:40</showtime>
                    </showtimes>
                </movie>
                <movie>
                    <movie_id>161906</movie_id>
                    <movie_name>Five Star Life (Viaggio sola), A</movie_name>
                    <movie_rating>NR</movie_rating>
                    <showtimes attributes="" sound="" allowpasses="Yes" comments="">
                        <showtime>12:40</showtime>
                        <showtime>17:20</showtime>
                    </showtimes>
                </movie>
                <movie>
                    <movie_id>163602</movie_id>
                    <movie_name>Zulu</movie_name>
                    <movie_rating>NR</movie_rating>
                    <showtimes attributes="" sound="" allowpasses="Yes" comments="">
                        <showtime>19:30</showtime>
                    </showtimes>
                </movie>
                <movie>
                    <movie_id>168086</movie_id>
                    <movie_name>Begin Again</movie_name>
                    <movie_rating>R</movie_rating>
                    <showtimes attributes="" sound="" allowpasses="Yes" comments="">
                        <showtime>13:40</showtime>
                        <showtime>16:20</showtime>
                    </showtimes>
                </movie>
</schedule>