Click here to Skip to main content
16,017,707 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to get xml file using PHP Dom and print the node values


my xml file is......

XML
<UIConfig>
 <Menu Mode="2"/>
 <ClientDiskUsage Value="74"/>
 <ServerDiskUsage Value="76"/>

 <ServerFrameRefresh Value="60"/>
 <ServerBackupType Value="0"/>
 <ServerMoreBackupsType Value="2"/>
 <ServerDaysLimit Value="2"/>
 <ServerClientActivityFrameRefresh Value="60"/>

</UIConfig>
Posted

i coded as below but nothing out pls guide me....
Thanks in Advancee

PHP
$xml = simplexml_load_file("UIConfig2.xml")
       or die("Error: Cannot create object");
$type=array();
foreach($xml->children() as $UIConfig)
    {
        foreach($UIConfig->children() as $Menu => $UIConfig)
        {
        echo "<br>";
        $type[]= $UIConfig->ClientDiskUsage['Value'];
        echo $type[0];
        echo $type[1];
        }
    }
 
Share this answer
 
v2
I solved this by Today.........

foreach($xml->children() as $Menu)
{
foreach($xml->Menu[0]->attributes() as $a => $b)
{

echo $Menu->getName().$Menu;
echo " ".$a;
echo " ".$Menu->attributes().$Menu."
";

}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900