<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Leggere un xml &quot;particolare&quot;]]></title><description><![CDATA[<p dir="auto">Ciao a tutti, c'è un metodo per leggere un xml simile ?</p>
<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;notizie&gt;
&lt;news data="18/12/2009 09:20:35"categoria="Internazionale" titolo="Metallica live a Zagabria" anteprima="Il tour della piu famosa band metal al mondo non fara tappa in Italia, la data piu vicina e in Croazia" testo="Dopo l annuncio del concerto italiano degli AC/DC, un altro grande appuntamento per i rockers piu scatenati con l esibizione live dei Metallica che s" immagine="http://www.xxxxx.it/assets/images/140x70_metallica2004.jpg" link="http://www.xxxxx.it/news/dett.php?id=26855"/&gt;

&lt;news data="18/12/2009 09:20:35"categoria="Internazionale" titolo="Metallica live a Zagabria" anteprima="Il tour della piu famosa band metal al mondo non fara tappa in Italia, la data piu vicina e in Croazia" testo="Dopo l annuncio del concerto italiano degli AC/DC, un altro grande appuntamento per i rockers piu scatenati con l esibizione live dei Metallica che s" immagine="http://www.xxxxx.it/assets/images/140x70_metallica2004.jpg" link="http://www.xxxxx.it/news/dett.php?id=26855"/&gt;

&lt;news data="18/12/2009 09:20:35"categoria="Internazionale" titolo="Metallica live a Zagabria" anteprima="Il tour della piu famosa band metal al mondo non fara tappa in Italia, la data piu vicina e in Croazia" testo="Dopo l annuncio del concerto italiano degli AC/DC, un altro grande appuntamento per i rockers piu scatenati con l esibizione live dei Metallica che s" immagine="http://www.xxxxx.it/assets/images/140x70_metallica2004.jpg" link="http://www.xxxxx.it/news/dett.php?id=26855"/&gt;
 
 &lt;/notizie&gt;
</code></pre>
<p dir="auto">Grazie!</p>
]]></description><link>https://dev.connect.gt/topic/117537/leggere-un-xml-quot-particolare-quot</link><generator>RSS for Node</generator><lastBuildDate>Mon, 30 Nov 2026 12:15:20 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/117537.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 18 Dec 2009 08:08:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Leggere un xml &quot;particolare&quot; on Fri, 18 Dec 2009 13:26:07 GMT]]></title><description><![CDATA[<p dir="auto">A chi potesse servire incollo la funzione per convertire tutto il testo in formato xml valido e riconoscibile da simplexml</p>
<pre><code class="language-php">  &lt;? 
function xmlEntities($str) 
{ 
    $xml = array('&amp;#34;','&amp;#38;','&amp;#38;','&amp;#60;','&amp;#62;','&amp;#160;','&amp;#161;','&amp;#162;','&amp;#163;','&amp;#164;','&amp;#165;','&amp;#166;','&amp;#167;','&amp;#168;','&amp;#169;','&amp;#170;','&amp;#171;','&amp;#172;','&amp;#173;','&amp;#174;','&amp;#175;','&amp;#176;','&amp;#177;','&amp;#178;','&amp;#179;','&amp;#180;','&amp;#181;','&amp;#182;','&amp;#183;','&amp;#184;','&amp;#185;','&amp;#186;','&amp;#187;','&amp;#188;','&amp;#189;','&amp;#190;','&amp;#191;','&amp;#192;','&amp;#193;','&amp;#194;','&amp;#195;','&amp;#196;','&amp;#197;','&amp;#198;','&amp;#199;','&amp;#200;','&amp;#201;','&amp;#202;','&amp;#203;','&amp;#204;','&amp;#205;','&amp;#206;','&amp;#207;','&amp;#208;','&amp;#209;','&amp;#210;','&amp;#211;','&amp;#212;','&amp;#213;','&amp;#214;','&amp;#215;','&amp;#216;','&amp;#217;','&amp;#218;','&amp;#219;','&amp;#220;','&amp;#221;','&amp;#222;','&amp;#223;','&amp;#224;','&amp;#225;','&amp;#226;','&amp;#227;','&amp;#228;','&amp;#229;','&amp;#230;','&amp;#231;','&amp;#232;','&amp;#233;','&amp;#234;','&amp;#235;','&amp;#236;','&amp;#237;','&amp;#238;','&amp;#239;','&amp;#240;','&amp;#241;','&amp;#242;','&amp;#243;','&amp;#244;','&amp;#245;','&amp;#246;','&amp;#247;','&amp;#248;','&amp;#249;','&amp;#250;','&amp;#251;','&amp;#252;','&amp;#253;','&amp;#254;','&amp;#255;'); 
    $html = array('&amp;quot;','&amp;amp;','&amp;amp;','&amp;lt;','&amp;gt;','&amp;nbsp;','&amp;iexcl;','&amp;cent;','&amp;pound;','&amp;curren;','&amp;yen;','&amp;brvbar;','&amp;sect;','&amp;uml;','&amp;copy;','&amp;ordf;','&amp;laquo;','&amp;not;','&amp;shy;','&amp;reg;','&amp;macr;','&amp;deg;','&amp;plusmn;','&amp;sup2;','&amp;sup3;','&amp;acute;','&amp;micro;','&amp;para;','&amp;middot;','&amp;cedil;','&amp;sup1;','&amp;ordm;','&amp;raquo;','&amp;frac14;','&amp;frac12;','&amp;frac34;','&amp;iquest;','&amp;Agrave;','&amp;Aacute;','&amp;Acirc;','&amp;Atilde;','&amp;Auml;','&amp;Aring;','&amp;AElig;','&amp;Ccedil;','&amp;Egrave;','&amp;Eacute;','&amp;Ecirc;','&amp;Euml;','&amp;Igrave;','&amp;Iacute;','&amp;Icirc;','&amp;Iuml;','&amp;ETH;','&amp;Ntilde;','&amp;Ograve;','&amp;Oacute;','&amp;Ocirc;','&amp;Otilde;','&amp;Ouml;','&amp;times;','&amp;Oslash;','&amp;Ugrave;','&amp;Uacute;','&amp;Ucirc;','&amp;Uuml;','&amp;Yacute;','&amp;THORN;','&amp;szlig;','&amp;agrave;','&amp;aacute;','&amp;acirc;','&amp;atilde;','&amp;auml;','&amp;aring;','&amp;aelig;','&amp;ccedil;','&amp;egrave;','&amp;eacute;','&amp;ecirc;','&amp;euml;','&amp;igrave;','&amp;iacute;','&amp;icirc;','&amp;iuml;','&amp;eth;','&amp;ntilde;','&amp;ograve;','&amp;oacute;','&amp;ocirc;','&amp;otilde;','&amp;ouml;','&amp;divide;','&amp;oslash;','&amp;ugrave;','&amp;uacute;','&amp;ucirc;','&amp;uuml;','&amp;yacute;','&amp;thorn;','&amp;yuml;'); 
    $str = str_replace($html,$xml,$str); 
    $str = str_ireplace($html,$xml,$str); 
    return $str; 
} 
?&gt;
</code></pre>
<p dir="auto">buon lavoro a tutti!</p>
]]></description><link>https://dev.connect.gt/post/879843</link><guid isPermaLink="true">https://dev.connect.gt/post/879843</guid><dc:creator><![CDATA[pettedemon]]></dc:creator><pubDate>Fri, 18 Dec 2009 13:26:07 GMT</pubDate></item><item><title><![CDATA[Reply to Leggere un xml &quot;particolare&quot; on Fri, 18 Dec 2009 13:12:49 GMT]]></title><description><![CDATA[<p dir="auto">Ciao!<br />
Ecco il mio script finale! Non volendo richiedere una nuova revisione del file xml ho pensato di aprire il file originale e dopo aver analizzato il contenuto di scriverlo in un altro file che a questo punto sarà perfetto per la lettura. il mio unico doppio è nella conversione dei caratteri speciali... c'è una scorciatoia oppure se aggiungono un nuovo caso mi si incasina ancora la lettura ?</p>
<pre><code class="language-php">//apro il file xml
$var=fopen("xxxxx/xxxxxnews.xml","r");
//leggo il file
$leggi=fread($var,filesize("xxxxx/xxxxxnews.xml"));

//sostituisco i caratteri html
$leggi = str_replace('&amp;deg;', ' ', $leggi);
$leggi = str_replace('&amp;amp;', 'e', $leggi);
$leggi = str_replace('&amp;gt;', '&gt;', $leggi);
$leggi = str_replace('&amp;quot;', '-', $leggi);
$leggi = str_replace('n&amp;amp;deg;', 'n', $leggi);

//elimino il problema della chiusura del tag
$leggi = str_replace('"/&gt;', '" /&gt;', $leggi);

//chiudo il file
fclose($var);

//apro il file che conterrà il nuovo codice
$var2=fopen("ok.xml","w");
//scrivo il nuovo codice
fwrite($var2, "$leggi");

//chiudo il file
fclose($var2);


//leggo il file sistemato
$leggere="ok.xml";

    $xml = simplexml_load_file($leggere);
    
    
    
foreach ($xml-&gt;children() as $second_gen) {
    echo '&lt;b&gt;DATA &lt;/b&gt;' . $second_gen['data'].'&lt;br&gt;';
    echo '&lt;b&gt;TITOLO &lt;/b&gt;' . $second_gen['titolo'].'&lt;br&gt;';
    echo '&lt;b&gt;ANTEPRIMA &lt;/b&gt;' . $second_gen['anteprima'].'&lt;br&gt;';
    echo '&lt;b&gt;TESTO&lt;/b&gt;' . $second_gen['testo'].'&lt;br&gt;';
    echo '&lt;b&gt;IMMAGINE&lt;/b&gt;&lt;img src="'. $second_gen['immagine'].'" width="140" height="70" /&gt;&lt;br&gt;';
    echo '&lt;b&gt;CATEGORIA &lt;/b&gt;' . $second_gen['categoria'].'&lt;br&gt;&lt;br&gt;';
}
</code></pre>
]]></description><link>https://dev.connect.gt/post/879842</link><guid isPermaLink="true">https://dev.connect.gt/post/879842</guid><dc:creator><![CDATA[pettedemon]]></dc:creator><pubDate>Fri, 18 Dec 2009 13:12:49 GMT</pubDate></item><item><title><![CDATA[Reply to Leggere un xml &quot;particolare&quot; on Fri, 18 Dec 2009 11:59:40 GMT]]></title><description><![CDATA[<p dir="auto">Perfetto!<br />
Adesso me lo legge! Ho fatto un ciclo per leggere tutto</p>
<pre><code class="language-php">foreach ($xml-&gt;children() as $second_gen) {
    echo '&lt;b&gt;DATA &lt;/b&gt;' . $second_gen['data'].'&lt;br&gt;';
    echo '&lt;b&gt;TITOLO &lt;/b&gt;' . $second_gen['titolo'].'&lt;br&gt;';
    echo '&lt;b&gt;ANTEPRIMA &lt;/b&gt;' . $second_gen['anteprima'].'&lt;br&gt;';
    echo '&lt;b&gt;TESTO&lt;/b&gt;' . $second_gen['testo'].'&lt;br&gt;';
    echo '&lt;b&gt;IMMAGINE&lt;/b&gt;&lt;img src="'. $second_gen['immagine'].'" width="140" height="70" /&gt;&lt;br&gt;';
    echo '&lt;b&gt;CATEGORIA &lt;/b&gt;' . $second_gen['categoria'].'&lt;br&gt;&lt;br&gt;';
}
</code></pre>
<p dir="auto">Adesso ho preso il file originale da leggere e ha il problema della chiusura /&gt; che non ha uno spazio, in più il testo è scritto direttamente in html e quindi mi genera un errore quando leggo i caratteri speciali tipo "&amp;deg" , come posso fare per ovviare a questi problemi?</p>
]]></description><link>https://dev.connect.gt/post/879841</link><guid isPermaLink="true">https://dev.connect.gt/post/879841</guid><dc:creator><![CDATA[pettedemon]]></dc:creator><pubDate>Fri, 18 Dec 2009 11:59:40 GMT</pubDate></item><item><title><![CDATA[Reply to Leggere un xml &quot;particolare&quot; on Fri, 18 Dec 2009 10:57:02 GMT]]></title><description><![CDATA[<p dir="auto">In realtà i problemi, secondo me, sono due:</p>
<ul>
<li>manca lo spazio qui: data="18/12/2009 09:20:35"categoria="Internazionale" (tra le virgolette della data e "categoria")</li>
<li>manca lo spazio alla fine del tag "news" prima dello slash (invece di link="<a href="http://www.xxxxx.it/news/dett.php?id=26855" rel="nofollow ugc">http://www.xxxxx.it/news/dett.php?id=26855</a>"/&gt; dovrebbe essere link="<a href="http://www.xxxxx.it/news/dett.php?id=26855" rel="nofollow ugc">http://www.xxxxx.it/news/dett.php?id=26855</a>" /&gt;)</li>
</ul>
<p dir="auto">Prova a risolvere queste cose (all'inizio magari a manina) e facci sapere sa va meglio</p>
]]></description><link>https://dev.connect.gt/post/879846</link><guid isPermaLink="true">https://dev.connect.gt/post/879846</guid><dc:creator><![CDATA[seo.italy]]></dc:creator><pubDate>Fri, 18 Dec 2009 10:57:02 GMT</pubDate></item><item><title><![CDATA[Reply to Leggere un xml &quot;particolare&quot; on Fri, 18 Dec 2009 10:35:31 GMT]]></title><description><![CDATA[<p dir="auto">Ciao, sto provando come mi hai suggerito ma già al caricare xml mi da errore, questo è il codice php</p>
<pre><code class="language-php">&lt;?php

    $xml = simplexml_load_file('rss.xml');
       print_r($xml);

?&gt;
</code></pre>
<p dir="auto">e questo è l'errore generato</p>
<pre><code class="language-php">Warning: simplexml_load_file() [function.simplexml-load-file]: rss.xml:4: parser error : attributes construct error in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: &lt;news data="18/12/2009 09:20:35"categoria="Internazionale" titolo="Metallica2 li in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: rss.xml:4: parser error : Couldn't find end of Start Tag news line 4 in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: &lt;news data="18/12/2009 09:20:35"categoria="Internazionale" titolo="Metallica2 li in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: rss.xml:6: parser error : attributes construct error in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: &lt;news data="18/12/2009 09:20:35"categoria="Internazionale" titolo="Metallica3 li in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: rss.xml:6: parser error : Couldn't find end of Start Tag news line 6 in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: &lt;news data="18/12/2009 09:20:35"categoria="Internazionale" titolo="Metallica3 li in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: rss.xml:8: parser error : attributes construct error in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: &lt;news data="18/12/2009 09:20:35"categoria="Internazionale" titolo="Metallica4 li in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: rss.xml:8: parser error : Couldn't find end of Start Tag news line 8 in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: &lt;news data="18/12/2009 09:20:35"categoria="Internazionale" titolo="Metallica4 li in /htdocs/xxxxxx2009/xml_reader.php on line 4

Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /htdocs/xxxxxx2009/xml_reader.php on line 4
</code></pre>
<p dir="auto">perchè non c'è il tag di chiusura alla fine, per questo non capivo come si potesse leggere un xml simile, solo &lt;notizie&gt; ha la chiusura in &lt;/notizie&gt; mentre news comincia con &lt;news e finisce con /&gt;</p>
]]></description><link>https://dev.connect.gt/post/879840</link><guid isPermaLink="true">https://dev.connect.gt/post/879840</guid><dc:creator><![CDATA[pettedemon]]></dc:creator><pubDate>Fri, 18 Dec 2009 10:35:31 GMT</pubDate></item><item><title><![CDATA[Reply to Leggere un xml &quot;particolare&quot; on Fri, 18 Dec 2009 08:32:16 GMT]]></title><description><![CDATA[<p dir="auto">Ciao<br />
puoi benissimo leggere e "trattare" questo XML con qualsiasi metodo supportato da PHP, a cominciare dal semplice <a href="http://php.net/manual/en/book.simplexml.php" rel="nofollow ugc">SimpleXML</a></p>
]]></description><link>https://dev.connect.gt/post/879844</link><guid isPermaLink="true">https://dev.connect.gt/post/879844</guid><dc:creator><![CDATA[seo.italy]]></dc:creator><pubDate>Fri, 18 Dec 2009 08:32:16 GMT</pubDate></item></channel></rss>