Hi:
I'm new to XML parsing, so pardon the basic quetions. :o
I have an XML file :
<getResponse>
<status>ok</status>
<lsg ident="0" extraStartTimeout="180" fixedPart="0" name="" >
<ls ident="1" allocMethod="static" bootOptions="" bootPgIdent="0" bootStatus="completed" >
<pg ident="0" ifName="" mode="" mtuSize="1518" pgIdent="0" state.admin="unlocked" >
<port ident="0" macAddress="00:17:25:E0:80:07" />
<vlanif ident="99" dhcp="no" />
</pg>
</ls>
<ls ident="2" allocMethod="static" bootOptions="" bootPgIdent="0" bootStatus="completed" >
<pg ident="0" ifName="" mode="" mtuSize="1518" pgIdent="0" state.admin="unlocked" >
<port ident="0" macAddress="00:17:25:E0:80:03" />
<vlanif ident="99" dhcp="no" />
</pg>
</ls>
</lsg>
</getResponse>
I need to access and display all the "ls' elements and their corrsponding sub-elements and attributes.
I'm not sure to use Xpath or simpleXML. I've been and am still reading about XML parsing.
I've got :
$library = simplexml_load_file('file.xml');
foreach ($library->lsg as $lsg)
{ echo $lsg['ident']; }
{
Which displays the lsg element.
I need help accessing the 'ls' elements, and I've tried a few things, but no luck yet!
Could you help please?
Kamy