Hi,
I’m trying to filter an XML file file by a string contained in a node.
I’m using SimpleXML to do it. However, I can only filter by the exact value of a node, I can’t filter by a part of that string. Here i my code:
<all>
<clothes>
<item>The big red shoe</item>
<price>44.99</price>
</clothes>
<clothes>
<item>Small red coat</item>
<price>4.99</price>
</clothes>
</all>
[PHP] $newresult = $result->xpath("//all/clothes/item[.=‘The big red shoe’]/…");
[/PHP]
It works only for the specific string ‘The big red shoe’. I want to instead show all results that contain the word ‘red’.
Any ideas?
Many thanks in advance