August 3rd, 2013, 03:16 PM
Filtering an XML file by a string
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:
<item>The big red shoe</item>
<item>Small red coat</item>
It works only for the specific string 'The big red shoe'. I want to instead show all results that contain the word 'red'.
$newresult = $result->xpath("//all/clothes/item[.='The big red shoe']/..");
Many thanks in advance
August 3rd, 2013, 03:45 PM