Ver Mensaje Individual
  #7 (permalink)  
Antiguo 22/02/2008, 14:04
juanvivo
 
Fecha de Ingreso: junio-2006
Mensajes: 46
Antigüedad: 17 años, 10 meses
Puntos: 0
Re: simplexml_load_file

Cita:
Iniciado por GatorV Ver Mensaje
Mmm leyendo mas a fondo prueba esto:
Código PHP:
$book $xml->children"book" );
$title $book->children"title" );
echo 
$title
Saludos.
Adaptado a mi caso, probe:

$book = $xml->apartado1->children( "sitio" );
$title = $book->children( "nombre" );

sin resultado.

Se esta resistiendo!!!

encontre esto por ahi:

Código:
 <?xml version="1.0"?>
  <entries xmlns:blog="http://www.edwardbear.org/serendipity/">
   <blog:entry>
    <blog:name>RPROF - Regular Expression Profiler</blog:name>
   </blog:entry>
   <blog:entry>
    <blog:name>Advanced PHP Programming</blog:name>
   </blog:entry>
  </entries>

To print out the names of all the different blog entries you could write the following code:


  <?php
  $entries = simplexml_load_file('syndic.xml');
  foreach ($entries->blog->entry as $entry) {
      printf("%s\n", $entry->name);
  }
  ?>
y probe:

$book = $xml->prueba->apartado1->sitio;
$title = $book->name;
echo $title;

Tampoco da resultado...

Última edición por juanvivo; 22/02/2008 a las 14:13