I have problem with getting specific name from xml file using xpath. Here is xml code:
<Zones>
<Zone ID="AFI" Quantity="67" Length="140" Open="0">
<Name LngID="IT">Name 1</Name>
<Name LngID="EN">Name 2</Name>
<Name LngID="DE">Name 3</Name>
</Zone>
<Zone ID="SLE" Quantity="1" Length="2" Open="0">
<Name LngID="IT">Name 4</Name>
<Name LngID="EN">Name 5</Name>
<Name LngID="DE">Name 6</Name>
</Zone>
</Zones>
And here is my php code:
foreach($area->Zones->Zone as $zone) {
$ZONE_ID = $zone['ID'];
$zone_lang = $zone->xpath("/Name[@LngID='EN']");
$ZONE_NAME = var_dum($zone_lang);
echo $ZONE_ID;
echo " - ";
echo $ZONE_NAME;
}
I need only EN
name of Name
item (Name LngID="EN" -> Name 2 and Name 5), but that code didn't work (I get Array value).
Any suggestion? Thank's in advice!