Ver Mensaje Individual
  #14 (permalink)  
Antiguo 17/06/2008, 12:34
sofway
 
Fecha de Ingreso: abril-2004
Mensajes: 154
Antigüedad: 20 años
Puntos: 0
Respuesta: Zend Framework consumiendo Web Service

OK, voy por partes entonces hasta lograr dar con el dato

Código:
$xml = '<?xml version="1.0" encoding="utf-8"?><entry xmlns:eltiempo="http://api.eltiempo.com/NS/API/1.0"><id>tag:api.eltiempo.com,2008:/eltiempo/articulos/CMS-4269823</id><title><![CDATA[Fiscalía abrió investigación penal contra sfsdfsfsd extorsivo]]></title><updated>2008-06-17T10:36:12-05:00</updated><link href="/1.0/eltiempo/articulos/CMS-4269823.json" rel="alternate" type="text/json"/><link href="/1.0/eltiempo/articulos/CMS-4269823.xml" rel="alternate" type="application/atom+xml"/><summary><![CDATA[Un fiscal especializado de la seccional de sdsdllamó a sda la ex sdpor el presunto sdsdde un ex sdsdde la sdsdde Bsdsd.]]></summary><category term="Justicia"/><author><name>sdsdfs</name></author><eltiempo:actividad xmlns:eltiempo="http://api.eltiempo.com/NS/API/1.0" eltiempo:comentarios="421" eltiempo:visitas="4373" eltiempo:votos="10" eltiempo:recomendaciones="0"/></entry>';
	
$xml = simplexml_load_string( $xml );
Primero obtengo 3 warnings que no se si son importantes

Código:
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xED 0x61 0x20 0x61 in c:\wamp\www\prueba1.php on line 7

Warning: simplexml_load_string() [function.simplexml-load-string]: api.eltiempo.com,2008:/eltiempo/articulos/CMS-4269823</id><title><![CDATA[Fiscal in c:\wamp\www\prueba1.php on line 7

Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in c:\wamp\www\prueba1.php on line 7
El paso siguiente es registrar el namespace como dice en el ejemplo

Código PHP:
<?php
$ns 
$xml->getNamespacestrue );
$xml->registerXPathNamespace('c'$ns['ns']); // En esta línea no sabría que reemplazar
$title $xml->xpath('//c:title'); // en esta tampoco
echo $title[0];
?>
__________________
Desdichado quien duerme en la mañana