Using xpath to return values

Hi,
just starting to use xml 3rd party data for the first time and there are a few bits i’m not getting my head around.

I’m using xpath and php and can currently return the array like this


$postcode = 'bs81ts';
$xmlinfo = simplexml_load_file("http://findyourmp.parliament.uk/api/search?q=".$postcode."&f=xml");

print_r($xmlinfo);

I’m getting stuck now as i want to pick up the individual components and echo them out in various places. I’ve found i can use xpath eg


$resulta = $xmlinfo->xpath("constituencies/constituency/member-name");
echo $resulta[0];

but this means i have to specify every child of constituency eg member-name, member-party etc separately for each variable i want.
I can’t work out how to return the array at the constituency level and then output the childen. eg xpath(“constituencies/constituency”);
then something like echo $resulta[0][1] etc

any pointers as to where i am going wrong?
thanks