This question is about querying an XML file. The file structure is below:
Inline Code Example Here

<?xml version="1.0" encoding="UTF-8"?>
        <text>Running around the lake</text>
        <text>Sailing around the lake</text>
        <text>Tracking up the mountain</text>
        <text>Steven Bullon is a photographer</text>

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');


I found the answer with this bit of code:

$desc = $xml->xpath('image[name="' . $file . '"]');
                    $description = $desc[0]->text;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.