Possible Duplicate:
PHP get values from SimpleXMLElement array
I am using simplexml_load_string()
to parse xml string. It reads the input correctly, but doesn't return any data only blank nodes.
My xml data is:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<leads>
<auth>
<username>user</username>
<password>user</password>
</auth>
</leads>
And the function is:
$xmlObj = simplexml_load_string($xml);
if ($xmlObj) {
echo "Failed loading XML\n";
foreach(libxml_get_errors() as $error) {
echo "\t", $error->message;
}
}
else{
print_r($xmlObj);
}
When I am trying to print the result I am getting a blank nodes like
<auth>
</username>
</password>
</auth>