Hi All
I'm have only 1 month programing php and need some help to resolve a problem with PHP and XML.
I have this XML file :
http://www.consultenos.com.ar/temp/test.xml
With this code I can only get data from RESERVATION tag, but y need from CCDATA, RESERVATIONDETAIL, SUPPLEMENT, DAYPRICE & GUEST.
$Cont_Res=0;
$Nodos = array();
$Reservas = array();
$xml = simplexml_load_file("/u/xml/test.xml");
print_r($xml);
echo "<br>";
//How many childs i have in each RESERVATION
foreach ($xml as $Res) {
$Nodos[$Cont_Res]= $Res->count();
echo $Nodos[$Cont_Res]."----- $Cont_Res <br />";
$Cont_Res++;
}
for ($x = 0; $x < $Cont_Res; $x++) {
echo "----------- RESERVATION-------- <br>";
//show each variable with value separately on root node
foreach($xml->reservation[$x]->attributes() as $a => $b) {
echo $a,'="',utf8_decode($b),"\"\n <br />";
}
//show each variable with value separately on children nodes
}
The OUTPUT is like this :
4----- 0
9----- 1
----------- RESERVATION--------
id="000020"
internalId="7366776"
(...)
cancancel="0"
changeable="1"
----------- RESERVATION--------
id="000010"
internalId="7366642"
(...)
cancancel="0"
changeable="1"
What I need is to put in the same form the data of the children nodes.
Thank you for any help !!!!