Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/02/2011, 15:50
Avatar de juanito1712
juanito1712
 
Fecha de Ingreso: mayo-2010
Ubicación: Valencia
Mensajes: 1.124
Antigüedad: 14 años
Puntos: 66
obtener datos de un xml con php

tengo un xml parecido al siguiente
Código XML:
Ver original
  1. <?xml version='1.0' encoding='UTF-8'?>
  2.     <feed>
  3.         <entry>
  4.             <id></id>
  5.            
  6.             <category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#video'/>
  7.             <category scheme='http://gdata.youtube.com/schemas/2007/categories.cat' term='People' label='Gente y blogs'/>
  8.             <category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='buenafuente'/>
  9.             <category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='la sexta'/>
  10.             <category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='andreu buenafuente'/>
  11.             <category scheme='http://gdata.youtube.com/schemas/2007/keywords.cat' term='gala goya'/>
  12.            
  13.             <media:group>
  14.                 <media:category label='Gente y blogs' scheme='http://gdata.youtube.com/schemas/2007/categories.cat'>People</media:category><media:content url='http://www.youtube.com/v/cEyFx_rVChk?f=videos&amp;app=youtube_gdata' type='application/x-shockwave-flash' medium='video' isDefault='true' expression='full' duration='133' yt:format='5'/>
  15.                 <media:content url='rtsp://v5.cache5.c.youtube.com/CiILENy73wIaGQkZCtX6x4VMcBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='133' yt:format='1'/>
  16.                 <media:content url='rtsp://v4.cache2.c.youtube.com/CiILENy73wIaGQkZCtX6x4VMcBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='133' yt:format='6'/>
  17.                 <media:description type='plain'></media:description>
  18.                 <media:keywords>buenafuente, la sexta, andreu buenafuente, gala goya</media:keywords>
  19.                 <media:player url='http://www.youtube.com/watch?v=cEyFx_rVChk&amp;feature=youtube_gdata_player'/>
  20.                 <media:thumbnail url='http://i.ytimg.com/vi/cEyFx_rVChk/0.jpg' height='240' width='320' time='00:01:06.500'/>
  21.                 <media:thumbnail url='http://i.ytimg.com/vi/cEyFx_rVChk/1.jpg' height='90' width='120' time='00:00:33.250'/>
  22.                 <media:thumbnail url='http://i.ytimg.com/vi/cEyFx_rVChk/2.jpg' height='90' width='120' time='00:01:06.500'/>
  23.                 <media:thumbnail url='http://i.ytimg.com/vi/cEyFx_rVChk/3.jpg' height='90' width='120' time='00:01:39.750'/>
  24.                 <media:title type='plain'>Buenafuente encargado de presentar los Goya</media:title>
  25.                 <yt:duration seconds='133'/>
  26.             </media:group>
  27.         </entry>
  28.     </feed>

soy capaz de acceder a varias etiquetas pero me resulta imposible obtener los de los campos que tienen : o los campos que no tienen contenido en su interior sino como una propiedad de la etiqueta

alguien sabe como se hace eso?

yo tengo esto
Código PHP:
Ver original
  1. $xml = simplexml_load_file($yt_urltot);
  2. //$xml = str_replace("media:","mediax",$xml);
  3. foreach ($xml->entry as $message){
  4. print("<div style='border:solid 1px #000000'>");
  5. print("<p style='color:red;'>".$message->title.'</p>');
  6. print("<p style='color:red;'>".$message->content.'</p>');
  7. print("<p style='color:red;'>".$message->author->name.'</p>');
  8. print("</div>");
  9. }

He tratado de hacer el reemplazo que se ve comentado pero no va tampoco