How to search within an xml data set?
- by user187580
Hi,
I have some xml data and I am trying to keyword search data. For example, if I search "some" for the following data it returns me the <id> and <title>.
<resource>
<id>101</id>
<title>Test Environment</title>
<description><b>Some</b> description. </description>
<type>classroom</type>
</resource>
<resource>
<id>102</id>
<title>ABC Test Environment</title>
<description><b>Some</b> another description. </description>
<type>classroom</type>
</resource>
...
I had a look on on xpath e.g. $xml->xpath('//title') but looks for elements only.
Basically what I need to do is to create a functionality where users can keyword search within the above data set which I receive from third party api in the above format. Any ideas how I can achieve this? using PHP/ Javascript etc.
Thanks.