Bojour, je reçois un fichier XMl de ce style (sans les traits d'unions en début de certaines lignes, c'est le copier/coller d'internet explorer çà) :

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
52
53
54
55
56
57
58
59
60
61
62
<?xml version="1.0" encoding="UTF-8" ?> 
  <!DOCTYPE ICECAT-interface (View Source for full doctype...)> 
- <!--  source: Icecat.biz 2011 
  --> 
- <ICECAT-interface xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://data.icecat.biz/xsd/ICECAT-interface_response.xsd">
- <Product Code="1" HighPic="http://images.icecat.biz/img/norm/high/1658576-HP.jpg" HighPicHeight="400" HighPicSize="28984" HighPicWidth="400" ID="1652451" LowPic="http://images.icecat.biz/img/norm/low/1658576-HP.jpg" LowPicHeight="200" LowPicSize="17101" LowPicWidth="200" Name="Imprimante HP Color LaserJet CP2025n" Prod_id="CB494A#B19" Quality="ICECAT" ReleaseDate="2008-08-03" ThumbPic="http://images.icecat.biz/thumbs/1658576.jpg" ThumbPicSize="4544" Title="HP Gamme d'imprimantes HP Color LaserJet CP2020 Imprimante HP Color LaserJet CP2025n">
- <Category ID="235">
  <Name ID="343980" Value="imprimantes laser et LED" langid="3" /> 
  </Category>
- <CategoryFeatureGroup ID="353" No="-1">
- <FeatureGroup ID="0">
  <Name ID="344646" Value="Détails techniques" langid="3" /> 
  </FeatureGroup>
  </CategoryFeatureGroup>
- <CategoryFeatureGroup ID="906" No="39">
- <FeatureGroup ID="1">
  <Name ID="344619" Value="Processeur" langid="3" /> 
  </FeatureGroup>
  </CategoryFeatureGroup>
- <CategoryFeatureGroup ID="2747" No="0">
- <FeatureGroup ID="2">
  <Name ID="344620" Value="Lecteur de disque" langid="3" /> 
  </FeatureGroup>
  </CategoryFeatureGroup>
<EANCode EAN="8835856138612" /> 
  <EANCode EAN="0883585613861" /> 
  <ProductBundled /> 
  <ProductDescription ID="22015773" LongDesc="" ManualPDFSize="0" ManualPDFURL="" PDFSize="0" PDFURL="" ShortDesc="HP Color LaserJet CP2025n Printer" URL="" WarrantyInfo="Garantie: Garantie limitée d'un an, retour au centre de service agréé. La garantie et les options d'assistance varient selon le produit, le pays et les spécifications juridiques locales.\n" langid="3" /> 
- <ProductFamily ID="48773">
  <Name ID="647790" Value="Gamme d'imprimantes HP Color LaserJet CP2020" langid="3" /> 
- <Series ID="1">
  <Name /> 
  </Series>
  </ProductFamily>
- <ProductFeature Localized="1" ID="35736970" Local_ID="19130392" Value="Y" CategoryFeature_ID="1291" CategoryFeatureGroup_ID="80" No="10114026" Presentation_Value="Oui" Translated="1" Mandatory="1" Searchable="1">
- <Feature ID="786">
- <Measure ID="29" Sign="">
  <Signs /> 
  </Measure>
  <Name ID="626097" langid="3" Value="Réseau prêt" /> 
  </Feature>
  </ProductFeature>
- <ProductFeature Localized="0" ID="45962001" Local_ID="0" Value="Y" CategoryFeature_ID="77" CategoryFeatureGroup_ID="80" No="10106624" Presentation_Value="Oui" Translated="1" Mandatory="1" Searchable="1">
- <Feature ID="46">
- <Measure ID="29" Sign="">
  <Signs /> 
  </Measure>
  <Name ID="344613" langid="3" Value="Couleur" /> 
  </Feature>
  </ProductFeature>
<ProductMultimediaObject>
  <MultimediaObject ContentType="text/html" Date="2011-09-06 10:19:13" Description="HP Color LaserJet CP2025n Printer" Height="0" KeepAsURL="1" MultimediaObject_ID="30740" Size="0" Type="movie" URL="http://objects.icecat.biz/objects/1652451-30740.html" Width="0" langid="3" /> 
  <MultimediaObject ContentType="text/html" Date="2010-01-05 13:43:42" Description="Imprimante HP Color LaserJet série CP2020" Height="0" KeepAsURL="1" MultimediaObject_ID="201314" Size="425895" Type="data sheet" URL="http://objects.icecat.biz/objects/1652451-201314.html" Width="0" langid="3" /> 
  </ProductMultimediaObject>
<SummaryDescription>
  <ShortSummaryDescription langid="3">HP Imprimante HP Color LaserJet CP2025n Gamme d'imprimantes HP Color LaserJet CP2020, Laser, 600 x 600 DPI, 750 à 2000 pages, 20 ppm, 20 ppm, 17.8 s</ShortSummaryDescription> 
  <LongSummaryDescription langid="3">HP Imprimante HP Color LaserJet CP2025n, Gamme d'imprimantes HP Color LaserJet CP2020. Qualité d'impression: Laser, 600 x 600 DPI, 750 à 2000 pages. Vitesse d'impression: 20 ppm, 20 ppm, 17.8 s, < 18 secondes (en mode Prêt). Mémoire vive: 128 Mo, 1 144-pin, DDR2 DIMM slot, DDR2, 384 Mo, Aucun. Processeur: 540 MHz, Motorola Coldfire V5x. Capacité d'entrée: 300 feuilles, feuilles : 50, transparents : 50, enveloppes : 10 feuilles. Capacité de sortie: 150 feuilles, 150 feuilles. Gestion du papier: Papier ordinaire, Bond paper, Papier recyclé, Enveloppes, Étiquettes, Transparences, Papier glacé, A4, A5, A6, B5, ISO DL, ISO C5, ISO B5. Connectivité: None. Technologie d'impression: HP PCL 6, HP PCL 5c, HP Postscript level 3 emulation, CMYB 4 . Gestion d'énergie: 445 watts, 6,7 watts, 0,48 watt. Poids et dimensions: 405 x 454 x 322 mm, 22700 g. Emballage: 26400 g, 600 x 500 x 479 mm. Conditions environnementales: 10 - 80 %, -20 - 40 °C, 15 - 30 °C, 10 - 95 %, 9144 m, 59 - 80.6 °F. Poids des supports: 60 to 176 g/m² (up to 220 g/m² with HP Color Laser Glossy Photo papers)</LongSummaryDescription> 
  </SummaryDescription>
  <Supplier ID="1" Name="HP" /> 
  </Product>
  </ICECAT-interface>
Et j'aimerais pouvoir en PHP récupérer ce qui est en rouge par exemple

J'ai comme base ce code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
$rss_file = file_get_contents("product.xml"); 
$xml = new SimpleXMLElement($rss_file); 
foreach($xml->Product[0]->attributes() as $a => $b) {    
	echo "<li>".$a, '="', $b, "\"";
}
Ou celui-ci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
  	$dom = new DomDocument();
  	$dom->load("product.xml");
 	$products = $dom->getElementsByTagName("Product");
	$count_elements = $products->length; 
	//Si $product->getAttribute("ID")=="" c'est que IP non autorisée dans WWW.ICECAT.BIZ
	if ($count_elements>0) {;
		foreach ($products as $product) {
...
C'est mieux DoDoculment ou SimpleXMLElement ?