I have an object that spits out this if i run this code:
print_r($xml->config->Exported->stats->children() );
SimpleXMLElement Object
(
[Stat] => Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => Name
[abrev] =>
[format] => 2
)
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => Hands
[abrev] => H:
[format] => 0
)
)
[2] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => V.total
[abrev] => V:
[format] => 0
)
)
)
My code is:
foreach($xml->config->Exported->stats->children() as $node){
echo $node . "<br />";
switch ( $node->getName() )
{
case 'Stat':
$stat_name = (string)$node['name'];
echo $stat_name . " | ";
break;
case 'New_Line':
echo '<hr />';
break;
}
Which should return something like this:
http://codepad.viper-7.com/hMvg9W
While that does work my code does not. Does the simple xml output differ from the standard xml output in the example that works, any idea how i tweak this to get it to work?