This question is about querying an XML file. The file structure is below:
Inline Code Example Here
<?xml version="1.0" encoding="UTF-8"?>
<descriptions>
<image>
<name>run.jpg</name>
<text>Running around the lake</text>
</image>
<image>
<name>sail.jpg</name>
<text>Sailing around the lake</text>
</image>
<image>
<name>track.jpg</name>
<text>Tracking up the mountain</text>
</image>
...
<image>
<name>Steven.jpg</name>
<text>Steven Bullon is a photographer</text>
</image>
</descriptions>
If know the name of the picture how do I get back the text that goes with the picture?
My latest try is below, but that does not work:
$desc = $xml->xpath('//image[name="'.$file.'"]/text');
Thanks!