Think your XML is lacking a root entry, so, parsing will stick. However, that issue aside, lookup simplexml_load_file and simplexml_load_string. Those are the simplest ways to access XML in a PHP-style structure.
In your XML sample, I've inserted a generic 'records' entry. For example:
$t = <<< EOF
<?xml version="1.0" encoding="iso-8859-1"?>
<records>
<employee>
<name>Mark</name>
<age>27</age>
<salary>$5000</salary>
</employee>
<employee>
<name>Jack</name>
<age>25</age>
<salary>$4000</salary>
</employee>
<employee>
<name>nav</name>
<age>25</age>
<salary>$4000</salary>
</employee>
</records>
EOF;
$x = @simplexml_load_string( $t );
print_r( $x );
Function is warning-suppressed since you probably don't want validation warnings. Anyhow, at this point, the parsed XML will look like this:
SimpleXMLElement Object
(
[employee] => Array
(
[0] => SimpleXMLElement Object
(
[name] => Mark
[age] => 27
[salary] => $5000
)
[1] => SimpleXMLElement Object
(
[name] => Jack
[age] => 25
[salary] => $4000
)
[2] => SimpleXMLElement Object
(
[name] => nav
[age] => 25
[salary] => $4000
)
)
)
"; } ?> – Mar 28 '12 at 05:46