Bonjour a tous,
Mon souci est simple : Je reçois un flux XML structuré tel que ci-dessous.
Code XML : 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 <?xml version="1.0" encoding="iso-8859-1" ?> <Response> <Merchand Code="NFF" Name="Nouvelles Frontières" Link="http://www.MyWebSite.com/Logos/NFF.gif"> <Airline Code="AA" Link="http://www.MyWebSite.com/cie/AA.gif"> <Details TotalPrice="661.25" Currency="EUR" Avalability="Y" Type="AR"> <Facts> <OutBound TravelDay="2007-09-10" ShiftedDay="N" Depart="CDG" Arrive="MEX" DirectFlight="Y"> <Times Departing="10:00:00" Arriving="21:50:00" OtherDay="0" /> </OutBound> <InBound TravelDay="2007-09-25" ShiftedDay="N" Depart="MEX" Arrive="CDG" DirectFlight="Y"> <Times Departing="10:55:00" Arriving="09:20:00" OtherDay="1" /> </InBound> </Facts> </Details> </Airline> <Airline Code="IB" Link="http://www.MyWebSite.com/cie/IB.gif"> <Details TotalPrice="465.32" Currency="EUR" Avalability="Y" Type="AR"> <Facts> <OutBound TravelDay="2007-09-10" ShiftedDay="N" Depart="CDG" Arrive="MEX" DirectFlight="Y"> <Times Departing="11:30:00" Arriving="23:32:00" OtherDay="0" /> </OutBound> <InBound TravelDay="2007-09-24" ShiftedDay="Y" Depart="MEX" Arrive="CDG" DirectFlight="Y"> <Times Departing="10:55:00" Arriving="09:20:00" OtherDay="1" /> </InBound> </Facts> </Details> </Airline> </Merchand> <Merchand Code="OPO" Name="OPODO" Link="http://www.MyWebSite.com/Logos/OPO.gif"> <Airline Code="AZ" Link="http://www.MyWebSite.com/cie/AA.gif"> <Details TotalPrice="600.20" Currency="EUR" Avalability="Y" Type="AR"> <Facts> <OutBound TravelDay="2007-09-10" ShiftedDay="N" Depart="CDG" Arrive="MEX" DirectFlight="Y"> <Times Departing="10:00:00" Arriving="21:50:00" OtherDay="0" /> </OutBound> <InBound TravelDay="2007-09-25" ShiftedDay="N" Depart="MEX" Arrive="CDG" DirectFlight="Y"> <Times Departing="10:55:00" Arriving="09:20:00" OtherDay="1" /> </InBound> </Facts> </Details> </Airline> <Airline Code="MX" Link="http://www.MyWebSite.com/cie/MX.gif"> <Details TotalPrice="944.02" Currency="EUR" Avalability="Y" Type="AR"> <Facts> <OutBound TravelDay="2007-09-10" ShiftedDay="N" Depart="CDG" Arrive="MEX" DirectFlight="Y"> <Times Departing="10:00:00" Arriving="21:50:00" OtherDay="0" /> </OutBound> <InBound TravelDay="2007-09-25" ShiftedDay="N" Depart="MEX" Arrive="CDG" DirectFlight="Y"> <Times Departing="10:55:00" Arriving="09:20:00" OtherDay="1" /> </InBound> </Facts> </Details> </Airline> </Merchand> </Response>
Pour générer mon affichage, je souhaite le trier par ordre croissant de prix (à savoir « <Details TotalPrice=… »
Je suis en PHP5 et utilise simple_XML. Y a-t-il un moyen de signifier quelque part les éléments de trie ?
Ou bien dois-je passer par une classe du Type Xml_In_Array. Si oui, il y a bien usort mais la fonction doit être coton !
Quelqu’un peut-il m’aider sur le sujet ?
Merci d’avance,
Partager