The XML, I have:
<?xml version="1.0" encoding="windows-1252" ?>
- <Tables>
- <Table name="I_BOOKING">
- <Row action="UPDATE" success="Y">
<Field name="AUTOBOOK">888800</Field>
<Field name="TOUROP">01</Field>
<Field name="REFERENCE">GSDFFD</Field>
<Field name="NBPAX">2</Field>
<Field name="NBINF">1</Field>
</Row>
</Table>
- <Table name="I_EXCDATERESA">
- <Row action="UPDATE" success="Y">
<Field name="EXCURS">KNO</Field>
<Field name="DATE">2012-04-12</Field>
<Field name="BOOKNR">125445</Field>
<Field name="NAME">TEST 12/4</Field>
<Field name="PICKUPTIME">00:00:00</Field>
</Row>
- <Row action="UPDATE" success="Y">
<Field name="EXCURS">KNO</Field>
<Field name="DATE">2012-04-13</Field>
<Field name="BOOKNR">14574575</Field>
<Field name="NAME">TEST 13/4</Field>
<Field name="PICKUPTIME">00:00:00</Field>
</Row>
</Table>
</Tables>
When I treat the table I_EXCDATERESA
, I need to get the value of Field BOOKNR
, so 125445
or 14574575
in this example, according to the row I am dealing with and load it in $autobook
:
...
$simplexml = simplexml_import_dom($dom);
foreach ($simplexml->Table as $value)
{
$tableName = $value->attributes()->name;
foreach ($value->Row as $value)
{
if ($tableName == 'I_EXCDATERESA')
{
if ($value->Field->attributes()->name == 'BOOKNR')
{
$autoBook = $value->Field;
This is not working, $autobook
is not loaded, as it is not on the first 'Field' but on the third