Access a XML sub nodes when node is known

Happy Sunday Sitepointers.

I want to pull the images into an array for a given property.

How do I do that?

XML sample:

<property>
<id>1204468</id>
<date>2013-04-09 14:28:44</date>
<price>179995</price>
<price_freq>sale</price_freq>
<type>
<en>villa</en>
</type>
<location_id>32721</location_id>
<town>Mazarron</town>
<postcode>30870</postcode>
<province>Murcia</province>
<location_detail></location_detail>
<beds>3</beds>
<baths>2</baths>
<pool>1</pool>
<images>
<image id="7854941">
<url>1204/1204468/7854941_large.jpg</url>
<primary>1</primary>
<title>
<en></en>
</title>
</image>
<image id="7854942">
<url>1204/1204468/7854942_large.jpg</url>
<title>
<en></en>
</title>
</image>
<image id="12052351">
<url>1204/1204468/12052351_large.jpg</url>
<title>
<en></en>
</title>
</image>
<image id="3986200">
<url>1204/1204468/3986200_large.jpg</url>
<title>
<en></en>
</title>
</image>
<image id="3986202">
<url>1204/1204468/3986202_large.jpg</url>
<title>
<en></en>
</title>
</image>
<image id="3986201">
<url>1204/1204468/3986201_large.jpg</url>
<title>
<en></en>
</title>
</image>
<image id="3986203">
<url>1204/1204468/3986203_large.jpg</url>
<title>
<en></en>
</title>
</image>
<image id="12052352">
<url>1204/1204468/12052352_large.jpg</url>
<title>
<en></en>
</title>
</image>
<image id="3986204">
<url>1204/1204468/3986204_large.jpg</url>
<title>
<en></en>
</title>
</image>
<image id="12052353">
<url>1204/1204468/12052353_large.jpg</url>
<title>
<en></en>
</title>
</image>
</images>
</property>

xpath?

$xml = new SimpleXMLElement($xmlAsString);
$images = $xml->xpath("/property[descendant::id='1204468']/images");

I tried this:


$xml = simplexml_load_file('file.xml');

function photos($id, $xml) {
	$property_id = $property->id;
	$xml = new SimpleXMLElement($xml);
	$photos = $xml->xpath("/property[descendant::id='$property_id']/images");
	return $photos;
}


and this


$xml_file = 'file.xml';
function photos($id, $xml_file) {
	$property_id = $property->id;
	$xml = new SimpleXMLElement($xml_file);
	$photos = $xml->xpath("/property[descendant::id='$property_id']/images");
	return $photos;
}


No joy. please help.

help please.