Bonjour tout le monde,
J'ai un petit problème avec le parsing d'un objet XML, voila mon code :
ce que je veux moi, c'est parser [description] => SimpleXMLElement Object ( ) pour récupérer le contenu, j'ai essayé comme ça mais je reçoi une erreur :
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 [channel] => SimpleXMLElement Object ( [title] => Mon Ecole de Commerce, orientation et information sur les ESC » Ecole en 4 ans [link] => <a href="http://www.mon-ecole-commerce.com" target="_blank">http://www.mon-ecole-commerce.com</a> [description] => MEC [lastBuildDate] => Fri, 24 Feb 2012 16:46:07 +0000 [language] => fr [generator] => <a href="http://wordpress.org/?v=3.2.1" target="_blank">http://wordpress.org/?v=3.2.1</a> [item] => Array ( [0] => SimpleXMLElement Object ( [title] => Rouen Business School BSc in International Business [link] => <a href="http://www.mon-ecole-commerce.com/ecole-de-commerce/ecole-apres-bac/ecole-en-4-ans/bsc-in-international-business.html" target="_blank">http://www.mon-ecole-commerce.com/ec...-business.html</a> [comments] => <a href="http://www.mon-ecole-commerce.com/ecole-de-commerce/ecole-apres-bac/ecole-en-4-ans/bsc-in-international-business.html#comments" target="_blank">http://www.mon-ecole-commerce.com/ec....html#comments</a> [pubDate] => Fri, 04 Feb 2011 15:10:17 +0000 [category] => Array ( [0] => SimpleXMLElement Object ( ) [1] => SimpleXMLElement Object ( ) ) [guid] => <a href="http://www.mon-ecole-commerce.com/?p=5289" target="_blank">http://www.mon-ecole-commerce.com/?p=5289</a> [description] => SimpleXMLElement Object ( ) )
voila l'erreur qui s'affiche :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 foreach($x->channel->item as $entry) { $desc = $entry->description; $df = new SimpleXmlElement($desc); echo "<pre>"; print_r($df); echo "</pre>"; }
Merci par avance pour votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 1: parser error : Start tag expected, '<' not found in C:\wamp\www\bigM\index.php on line 110
Partager