- Home
- Categorie
- Coding e Sistemistica
- Coding
- problema nella lettura xml con simplexml
-
problema nella lettura xml con simplexml
Ciao a tutti, io con simplexml vorrei leggere un xml fornito da un blog creato con wordpress. La struttura dell'xml è la seguente:
[php]<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"<channel>
<title>titolo</title>
<atom:link href="http://www.sito.it/blog/feed/" rel="self" type="application/rss+xml" />
<link>www.xxx.it</link>
<description>descrizione</description>
<lastBuildDate>Sat, 06 Feb 2010 00:33:53 +0000</lastBuildDate><generator>http://wordpress.org/?v=2.8</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item> <title>titolo articolo</title> <link>www.link.it</link> <comments>commenti</comments> <pubDate>Sat, 06 Feb 2010 00:29:36 +0000</pubDate> <dc:creator>PROnWeb</dc:creator> <category><![CDATA[Mouse e Tastiere]]></category> <category><![CDATA[Pc & Mac]]></category> <category><![CDATA[Wacom]]></category> <category><![CDATA[Bluetooth]]></category> <category><![CDATA[Express Key]]></category> <category><![CDATA[Grip Pen]]></category> <category><![CDATA[Intuos4]]></category> <category><![CDATA[OLED]]></category> <category><![CDATA[prezzo]]></category> <category><![CDATA[tavoletta grafica]]></category> <category><![CDATA[Tip Sensor]]></category> <category><![CDATA[Touch Ring]]></category> <category><![CDATA[USB]]></category> <category><![CDATA[wireless]]></category> <guid isPermaLink="false">http://www.sito.it/blog/?p=2357</guid> <description><![CDATA[Wacom Intuos4 Wireless è la nuova tavoletta grafica professionale con connettività Bluetooth.]]></description> <content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2358" title="wacom-intuos4-wireless" src="http://www.sito.it/blog/wp-content/uploads/2010/02/wacom-intuos4-wireless.jpg" alt="wacom-intuos4-wireless" width="500" height="350" /></p><br/><br/>]]></content:encoded>
wfw:commentRsshttp://www.sito.it/blog/2010/02/06/wacom-intuos4-wireless-tavoletta-grafica-bluetooth/feed/</wfw:commentRss>
slash:comments0</slash:comments></item> </channel></rss>
[/php]quindi dovrebbe essere questo
[php]<rss>
<channel>
<item>
<title></title>
<description></description>
</item>
</channel>
</rss>[/php]a questo punto il mio php per leggere la funzione:
[php]
$dato="http://www.sito.it/blog/feed/index.php";$xml = simplexml_load_file($dato);
foreach($xml->channel as $channel) { foreach($channel as $item){ echo '<strong>'.$item->title.'</strong> '.$item->description.'</br>'; } }[/php]il mio problema è che prima dell'estratto mi visualizza una serie di ```
<strong></strong> </br>Grazie!