IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Symfony PHP Discussion :

sfFeed2Plugin-1.2.4 incompatible avec <![CDATA[ [1.x]


Sujet :

Symfony PHP

  1. #1
    Membre habitué Avatar de remyli
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    270
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 270
    Points : 151
    Points
    151
    Par défaut sfFeed2Plugin-1.2.4 incompatible avec <![CDATA[
    Bonjour à tous,

    J'ai un problème avec sfFeed2Plugin-1.2.4

    J'utilise le plugin pour
    1) récupérer un flux RSS partenaire
    2) le transformer en Objets
    3) pour pouvoir l'afficher dans ma page.

    Dans sfRssFeed.class à la ligne 52 le XML est transformé en objet via la fonction simplexml_load_string()

    Et là j'ai deux comportements différents suivant les flux.

    Cas 1
    On est bien sur du Rss 2 mais la fonction génère une serie de warning et ne retourne par d'objet.
    http://feeds.feedburner.com/Contispl...tDeContisPlage
    Le XML
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    <?xml  version="1.0" encoding="ISO-8859-1"?>
    <rss version="2.0" xmlns:ra="http://www.feedshow.com/xmlrss/remoteads/"> 
    <channel> 
     
    <title>ContisPlage.com: L'actualité de Contis Plage</title> 
    <description>Toute l'actualité de Contis-Plage et sa région.</description> 
    <link>http://www.contisplage.com</link>
    <language>fr</language>
     
    <item> 
    <title>"Contis-Plage vu du ciel"</title> 
    <description><![CDATA[<a href="http://www.contisplage.com/"><img src="http://www.contisplage.com/rss/archives.jpg" alt="Archives" border="0" width="76" height="76" align="left" style="margin-right: 10px;" /></a><p><b>Festival</b></p><p>Evènement</p><p>Le survol de Contis-Plage, c'est désormais possible ...</p>
    <a href="http://www.facebook.com/pages/Contis-Plage-sur-ContisPlagecom/57927408769">Avant-premières : Rejoignez-nous sur Facebook</a>]]>
    </description> 
     
    <link>http://www.contisplage.com/</link>
    <pubDate>Sun, 17 Jun 2009 23:58:00 CET</pubDate> 
    </item>
     
    </channel> 
    </rss>
    Les Warnings
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Sequence ']]>' not allowed in content in /home/microcos-dev/Dev-nux/maplage-dev/trunk/plugins/sfFeed2Plugin-1.2.4/lib/sfRssFeed.class.php on line 52
     
    Warning: simplexml_load_string() [function.simplexml-load-string]: r-ContisPlagecom/57927408769">Avant-premières : Rejoignez-nous sur Facebook</a> in /home/microcos-dev/Dev-nux/maplage-dev/trunk/plugins/sfFeed2Plugin-1.2.4/lib/sfRssFeed.class.php on line 52
     
    Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/microcos-dev/Dev-nux/maplage-dev/trunk/plugins/sfFeed2Plugin-1.2.4/lib/sfRssFeed.class.php on line 52
     
    Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : internal error in /home/microcos-dev/Dev-nux/maplage-dev/trunk/plugins/sfFeed2Plugin-1.2.4/lib/sfRssFeed.class.php on line 52
     
    Warning: simplexml_load_string() [function.simplexml-load-string]: r-ContisPlagecom/57927408769">Avant-premières : Rejoignez-nous sur Facebook</a> in /home/microcos-dev/Dev-nux/maplage-dev/trunk/plugins/sfFeed2Plugin-1.2.4/lib/sfRssFeed.class.php on line 52
     
    Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/microcos-dev/Dev-nux/maplage-dev/trunk/plugins/sfFeed2Plugin-1.2.4/lib/sfRssFeed.class.php on line 52
     
    Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Extra content at the end of the document in /home/microcos-dev/Dev-nux/maplage-dev/trunk/plugins/sfFeed2Plugin-1.2.4/lib/sfRssFeed.class.php on line 52
     
    Warning: simplexml_load_string() [function.simplexml-load-string]: r-ContisPlagecom/57927408769">Avant-premières : Rejoignez-nous sur Facebook</a> in /home/microcos-dev/Dev-nux/maplage-dev/trunk/plugins/sfFeed2Plugin-1.2.4/lib/sfRssFeed.class.php on line 52
     
    Warning: simplexml_load_string() [function.simplexml-load-string]: ^ in /home/microcos-dev/Dev-nux/maplage-dev/trunk/plugins/sfFeed2Plugin-1.2.4/lib/sfRssFeed.class.php on line 52
    Cas 2
    On est toujours sur du Rss 2 mais cette fois ça marche.
    http://blog.maplage.fr/feed/
    Le XML
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
     
    <?xml version="1.0" encoding="UTF-8"?>
    <rss version="2.0"
    	xmlns:content="http://purl.org/rss/1.0/modules/content/"
    	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    	xmlns:dc="http://purl.org/dc/elements/1.1/"
    	xmlns:atom="http://www.w3.org/2005/Atom"
    	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    	>
     
    <channel>
    	<title>Le Blog de maPlage</title>
    	<atom:link href="http://blog.maplage.fr/feed/" rel="self" type="application/rss+xml" />
    	<link>http://blog.maplage.fr</link>
    	<description>Le littoral un peu, beaucoup, à la folie!!</description>
    	<lastBuildDate>Tue, 17 Nov 2009 10:36:40 +0000</lastBuildDate>
     
    	<generator>http://wordpress.org/?v=2.8.4</generator>
    	<language>en</language>
    	<sy:updatePeriod>hourly</sy:updatePeriod>
    	<sy:updateFrequency>1</sy:updateFrequency>
    			<item>
    		<title>A la recherche de plagistes correspondants locaux</title>
     
    		<link>http://blog.maplage.fr/2009/11/17/a-la-recherche-de-plagistes-correspondants-locaux/</link>
    		<comments>http://blog.maplage.fr/2009/11/17/a-la-recherche-de-plagistes-correspondants-locaux/#comments</comments>
    		<pubDate>Tue, 17 Nov 2009 10:36:40 +0000</pubDate>
    		<dc:creator>florian</dc:creator>
    				<category><![CDATA[Actualités]]></category>
    		<category><![CDATA[Featured]]></category>
    		<category><![CDATA[maplage]]></category>
     
    		<guid isPermaLink="false">http://blog.maplage.fr/?p=300</guid>
    		<description><![CDATA[Bonjour les plagistes.
    Cette fois c’est décidé, on a besoin de vous et de vos talents  de reporters sans frontières afin de nous fournir de l’information locale !
    Je ne peux pas malheureusement pas encore vous dévoiler votre future communauté de plagistes puisqu’elle est encore dans les cartons, mais en attendant on va pouvoir commencer à [...]]]></description>
    			<content:encoded><![CDATA[<p>Bonjour les plagistes.</p>
    <p>Cette fois c’est décidé, on a besoin de vous et de vos talents  de reporters sans frontières afin de nous fournir de l’information locale !</p>
    <p>Je ne peux pas malheureusement pas encore vous dévoiler votre future communauté de plagistes puisqu’elle est encore dans les cartons, mais en attendant on va pouvoir commencer à se connaître sans attendre <img src='http://blog.maplage.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
    <p>Nous sommes donc en plein tour de France des plages à la rechercher de blogs (ou autres formats) locaux, gérés par des personnes passionnées par leur petit bout de bord de mer et son activité au quotidien.</p>
    <p>Etant donné qu’il existe quelques 723 communes du bord de mer et peut-être autant (voire plus) de blogs locaux, n’hésitez pas à vous manifester si vous désirez devenir un plagiste certifié <img src='http://blog.maplage.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
    <p>Pour ceux qui auraient l’envie mais qui ne dispose pas d’un blog ou autre support, contactez nous également, nous nous ferons un plaisir de vous aider dans votre démarche.</p>
    <p style="text-align: center;">Pour nous contacter : <a href="mailto:florian@maplage.fr">florian<img class="alignnone size-full wp-image-301" title="arobase" src="http://blog.maplage.fr/wp-content/uploads/2009/11/arobase.png" alt="arobase" width="20" height="20" />maplage.fr</a> ou par téléphone : 02 40 20 25 94</p>
    <p style="text-align: center;"><img class="aligncenter size-full wp-image-303" title="correspondant" src="http://blog.maplage.fr/wp-content/uploads/2009/11/correspondant.png" alt="correspondant" width="300" height="300" /></p>
    ]]></content:encoded>
    			<wfw:commentRss>http://blog.maplage.fr/2009/11/17/a-la-recherche-de-plagistes-correspondants-locaux/feed/</wfw:commentRss>
    		<slash:comments>0</slash:comments>
    		</item>
    </channel>
    </rss>

    Je me suis donc dit que la fonction ne digéré pas les '<![CDATA[ ]]>'

    J'ai donc tester ça :
    $feedXml = MP_SF::get_partial("test/xml");
    $feedXml = str_replace(']]>', '', $feedXml);
    $feedXml = str_replace('<![CDATA[', '', $feedXml);
    $feedXml = str_replace('^', '', $feedXml);
    aze::debug($xml,1);
    $feedXml = simplexml_load_string($xml);

    Mais dans ces conditions j'ai l'erreur inverse !
    Orthographe => Message Privé constructif svp

  2. #2
    Membre habitué Avatar de remyli
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    270
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 270
    Points : 151
    Points
    151
    Par défaut CODE
    Voici un exemple de code pour illustrer mon problème.
    On remarque que seul le premier flux pose problème ...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
        function executeT02()
        {
            $liste = array();
            $liste[] = 'http://feeds.feedburner.com/ContisplagecomLactualitDeContisPlage'; //2.0
            $liste[] = 'http://blog.maplage.fr/feed/'; // 2.0
            $liste[] = 'http://ceciliaschola.org/feed/atom/'; // atom
            $liste[] = 'http://ceciliaschola.org/feed/'; // 2.0
            $liste[] = 'http://ceciliaschola.org/feed/rss/'; // rss .92';
            $liste[] = 'http://feeds.feedburner.com/~u/10864337617278120548';
            $liste[] = 'http://feeds.feedburner.com/symfony/blog';
            $liste[] = 'http://www.01net.com/rss/actus.xml';
            $liste[] = 'http://feeds.feedburner.com/Pressecitron';
     
            foreach($liste as $url)
            {
                echo "\n<br/>"."<h1>-----TEST : $url</h1>";
                try
                {
                    $obj = simplexml_load_file($url);
                    //print_r($obj);
                    if($obj){
                        echo "\n<br/>"."OK  :)";
                    }else{
                        echo "\n<br/>"."Nooonnnnn :'(";
                    }
                }
                catch(Exception $e)
                {
                    echo "\n<br/>"."Exception : ".$e;
                }
            }
     
            echo "\n<br/>"."<h1>FIN</h1>";
            die();
        }
    Orthographe => Message Privé constructif svp

  3. #3
    Membre habitué Avatar de remyli
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    270
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 270
    Points : 151
    Points
    151
    Par défaut les Warnings
    Warning: simplexml_load_file() [function.simplexml-load-file]: http://feeds.feedburner.com/Contispl...ContisPlage:1: parser error : Sequence ']]>' not allowed in content in /home/microcos-dev/Dev-nux/maplage-dev/trunk/apps/front/modules/test/actions/actions.class.php on line 138

    Warning: simplexml_load_file() [function.simplexml-load-file]: r-ContisPlagecom/57927408769">Avant-premières : Rejoignez-nous sur Facebook</a> in /home/microcos-dev/Dev-nux/maplage-dev/trunk/apps/front/modules/test/actions/actions.class.php on line 138

    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/microcos-dev/Dev-nux/maplage-dev/trunk/apps/front/modules/test/actions/actions.class.php on line 138

    Warning: simplexml_load_file() [function.simplexml-load-file]: http://feeds.feedburner.com/Contispl...ContisPlage:1: parser error : internal error in /home/microcos-dev/Dev-nux/maplage-dev/trunk/apps/front/modules/test/actions/actions.class.php on line 138

    Warning: simplexml_load_file() [function.simplexml-load-file]: r-ContisPlagecom/57927408769">Avant-premières : Rejoignez-nous sur Facebook</a> in /home/microcos-dev/Dev-nux/maplage-dev/trunk/apps/front/modules/test/actions/actions.class.php on line 138

    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/microcos-dev/Dev-nux/maplage-dev/trunk/apps/front/modules/test/actions/actions.class.php on line 138

    Warning: simplexml_load_file() [function.simplexml-load-file]: http://feeds.feedburner.com/Contispl...ContisPlage:1: parser error : Extra content at the end of the document in /home/microcos-dev/Dev-nux/maplage-dev/trunk/apps/front/modules/test/actions/actions.class.php on line 138

    Warning: simplexml_load_file() [function.simplexml-load-file]: r-ContisPlagecom/57927408769">Avant-premières : Rejoignez-nous sur Facebook</a> in /home/microcos-dev/Dev-nux/maplage-dev/trunk/apps/front/modules/test/actions/actions.class.php on line 138

    Warning: simplexml_load_file() [function.simplexml-load-file]: ^ in /home/microcos-dev/Dev-nux/maplage-dev/trunk/apps/front/modules/test/actions/actions.class.php on line 138
    Orthographe => Message Privé constructif svp

  4. #4
    Membre habitué Avatar de remyli
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    270
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 270
    Points : 151
    Points
    151
    Par défaut
    Bien, Il semblerais que se soit le flux de mon partenaire qui ne soit pas très conforme...

    Bizarre puisque j'arrive à le lire dans pleins d'autres lecteurs.


    Mon problème est résolut.
    Orthographe => Message Privé constructif svp

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Visual Studio 2003] Est-il incompatible avec le framework 2.0 ?
    Par maestro20 dans le forum Visual Studio
    Réponses: 7
    Dernier message: 13/07/2006, 13h20
  2. Checkbox incompatible avec Opera ???
    Par pam_ela dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 20/04/2006, 09h28
  3. ACCESS 2002 (XP) incompatible avec lui même ?
    Par xanthos1348 dans le forum Access
    Réponses: 1
    Dernier message: 05/12/2005, 23h23
  4. Réponses: 9
    Dernier message: 06/07/2005, 14h20
  5. ODBC Access => Type Incompatible avec un champ DATE ?
    Par MaTHieU_ dans le forum C++Builder
    Réponses: 6
    Dernier message: 23/04/2005, 02h02

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo