i have problem, i want get all data from my xml file in many tags name. but when i loop, just get one in first tag. sory my english.
this is my code and sample format xml.
Code:
$xml = @simplexml_load_file('C://xampp/htdocs/logxml.xml');
foreach ($xml->children() as $b){
echo $MakeAndModel = $b->{'xdm:ComponentGroup'}->{'xdm:Component'}->{'dd:DigitalStorageTypeEnum'};
}
<xdm:ComponentGroup>
<xdm:Component id="dev1300" componentType="digitalStorage">
<dd:DigitalStorageTypeEnum>harddisk</dd:DigitalStorageTypeEnum>
<dd:Capacity>
<dd:MaxCapacity>16</dd:MaxCapacity>
<dd:Unit>bytes</dd:Unit>
</dd:Capacity>
</xdm:Component>
</xdm:ComponentGroup>
<xdm:Component id="dev1350" componentType="digitalStorage">
<dd:DigitalStorageTypeEnum>ram</dd:DigitalStorageTypeEnum>
<dd:Capacity>
<dd:MaxCapacity>1040187392</dd:MaxCapacity>
<dd:Unit>bytes</dd:Unit>
</dd:Capacity>
</xdm:Component>
output = hardisk, no one else
and below of my real xml file still have many same tags name that i want to get the value. but it doesn't work. anyone help please.