I try to get data from XML file. The data looks like this:
<MeasuringPoints>
<MeasuringPoint ID="Base" LastChange="2013-05-17T09:29:59.293" WeatherCondition="8">
<Name LngID="IT">Name 1</Name>
<Name LngID="DE">Name 2</Name>
<Name LngID="EN>Name 3</Name>
</MeasuringPoint>
<MeasuringPoint ID="Middle" LastChange="2012-08-01T11:47:33.160" WeatherCondition="14">
<Name LngID="IT">Name 1a</Name>
<Name LngID="DE">Name 2a</Name>
<Name LngID="EN">Name 3a</Name>
</MeasuringPoint>
<MeasuringPoint ID="Top" LastChange="2013-05-17T09:29:59.293" WeatherCondition="8">
<Name LngID="DE">Name 1b</Name>
<Name LngID="IT">Name 2b</Name>
<Name LngID="EN">Name 3b</Name>
</MeasuringPoint>
</MeasuringPoints>
I also have this php code:
foreach ($xml->Area as $area)
{
$MEASURING_POINTS = $area->MeasuringPoints->MeasuringPoint['ID'];
$MEASURING_LAST_CHANGE = $area->MeasuringPoints->MeasuringPoint['LastChange'];
echo $MEASURING_POINTS;
echo " - ";
echo $MEASURING_LAST_CHANGE;
}
The code is working but only for first MeasuringPoint
(the Base
ID).
How to get the data from other MeasuringPoint
(Middle
and Top
ID)?
Thanks for any help!
Adrian