Hi:
I have 3 XMl files, from which I need to extract proper info and display in a table format.
Here are the (simplified )XML files:
file1
<chassis ident="0">
<aimslot>
<module state.admin="unlocked" state.operational="enabled" state.service="started" />
</aimslot>
<amslot>
<module state.admin="unlocked" state.operational="enabled" state.service="started" />
</amslot>
<ftmslot ident="0">
<module state.admin="unlocked" state.operational="enabled" state.service="started" />
</ftmslot>
<ftmslot ident="1">
<module state.admin="unlocked" state.operational="enabled" state.service="started" />
</ftmslot>[/
</chassis>
file 2
<chassis ident="0">
<aimslot>
<module>
<common moduleType="AIM" productCode="0100-50800" revisionNumber="02" serialNumber="00040" slotNumber="44" state.admin="unlocked" state.operational="enabled" state.service="started" />
</module>
</aimslot>
<amslot>
<module>
<common moduleType="AM" productCode="0100-52100" revisionNumber="01" serialNumber="00040" slotNumber="12" state.admin="unlocked" state.operational="enabled" state.service="started" />
</module>
</amslot>
<ftmslot ident="0">
<module>
<common moduleType="FTM" productCode="0100-50400" revisionNumber="17" serialNumber="00244" slotNumber="43" state.admin="unlocked" state.operational="enabled" state.service="started" />
</module>
</ftmslot>
<ftmslot ident="1">
<module>
<common moduleType="FTM" productCode="0100-50400" revisionNumber="17" serialNumber="00053" slotNumber="45" state.admin="unlocked" state.operational="enabled" state.service="started" />
</module>
</ftmslot>
</chassis>
file 3:
<chassis ident="0">
<aimslot>
<module>
<software version="6.0.0-1.0.0_rev_11045_2008_05_15at23_22_56_SANITY" />
</module>
</aimslot>
<amslot>
<module>
<software version="6.0.0-1.0.0_rev_11045_2008_05_15at23_22_56_SANITY" />
</module>
</amslot>
<ftmslot ident="0">
<module>
<software version="6.0.0-1.0.0_rev_11045_2008_05_15at23_22_56_SANITY" />
</module>
</ftmslot>
<ftmslot ident="1">
<module>
<software version="6.0.0-1.0.0_rev_11045_2008_05_15at23_22_56_SANITY" />
</module>
</ftmslot>
</chassis>
I can display the content of one file with a code like this:
<?
$system = simplexml_load_file('query2.xml');
$slot= $system->chassis->ftmslot;
foreach ($slot as $ftmslot)
{
echo $ftmslot['ident']."";
foreach ($ftmslot->module->children() as $test )
{
echo $test['moduleType']." ";
echo $test['productCode']." ";
echo $test['revisionNumber']." ";
echo $test['serialNumber']." ";
echo $test['slotNumber']." ";
echo $test['state.admin']." ";
echo $test['state.operational']." ";
echo $test['state.service']."<hr>";
}
}
?>
I need to display the results of 3 queries in a table row.
For example "aimslot", I need to display all its properties from the 3 queries in 1 row.
Not sure if I should create 3 arrays and populate them with these data?
Is there a function/class to handle this ?
let me kow what you think.
Kamy