XPath query returning 'false' in SimpleXML
- by Drew
Hi all,
I have an xml fragment as such:
<meta_tree type="root">
<meta_data>
<meta_cat>Content Provider</meta_cat>
<data>Mammoth</data>
</meta_data>
<meta_data>
<meta_cat>Genre</meta_cat>
<data>Games</data>
</meta_data>
<meta_data>
<meta_cat>Channel Name</meta_cat>
<data>Games Trailers</data>
</meta_data>
<meta_data>
<meta_cat>Collection</meta_cat>
<data>Strategy</data>
</meta_data>
<meta_data>
<meta_cat>Custom 1</meta_cat>
<data>PC</data>
</meta_data>
<meta_data>
<meta_cat>DRM Protected</meta_cat>
<data>N</data>
</meta_data>
<meta_data>
<meta_cat>Aspect Ratio</meta_cat>
<data>16:9</data>
</meta_data>
<meta_data>
<meta_cat>Streaming Type</meta_cat>
<data>VOD</data>
</meta_data>
</meta_tree>
which I garnered from the snippet of $meta_tree->asXML().
So given that, I need to have an xpath query for each element, so I'm using:
$meta_tree->xpath("/meta_data[meta_cat='Content Provider']");
but this returns false.
I have tried:
"/meta_tree/meta_data[meta_cat='Content Provider']"
"//meta_data[meta_cat='Content Provider']"
I've been using AquaPath, which validates my query, so I'm not sure what I'm doing wrong.
Anyone got any ideas?
DJS.