Bonjour,

J'ai un soucis pour traiter un flux XML qui contient des balises "hors normes" (en tout cas j'en avais jamais traité ainsi).

Exemple de flux :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
<store:PRODUCTLIST xmlns:store="http://www.*****/XML/schema" generation_timestamp="1285847838">
        <store:PRODUCT IDPRODUCT="465963" IDMETAPRODUCT="5669" ISONLINE="1" ISNEW="0"> 
		<store:NAMESHORT>Cafetière SENSEO</store:NAMESHORT> 
		<store:NAMELONG>Cafetière SENSEO Bleue + 2 tasses</store:NAMELONG> 
		<store:PRICE CURRENCY="EUR">19.95</store:PRICE> 
		<store:CATEGORIES> 
			<store:CATEGORY IDPRODUCTTYPE="69">Electroménager</store:CATEGORY> 
		</store:CATEGORIES> 
	</store:PRODUCT> 
</store:PRODUCTLIST>
J'ai essayé avec SimpleXML, mais il est impossible de faire (à cause des ":") :
Avec un bon moment de recherche sur google, j'ai essaye le xpath() :
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
 
$liste = simplexml_load_file('http://xml.*******'); 
 
foreach ($liste->xpath('store:PRODUCT') as $produits) {	
 
  		echo "ID {".$produits['IDPRODUCT']."} <br />"; 
 
		$nameshort = $produits->xpath('store:NAMESHORT');
		echo "NOM {".$nameshort[0]."} <br />"; 
 
  			foreach ($produits->xpath('store:CATEGORIES') as $cats) { 				
				foreach ($cats->xpath('store:CATEGORY') as $cat) { 
    				echo "Categorie : {".$cat->IDPRODUCTTYPE."} <br />";
				}
    		} 
  	 echo '<hr/>';
}
Là tout fonctionne sauf la partie "categories". Il ne me sort rien :'(

Quelqu'un a une solution svp ?

Merci bien.