06-12-2011, 12:42 AM
|
#1 (permalink)
|
|
The Visitor
Join Date: Jun 2011
Location: Normandy
Posts: 2
Thanks: 0
|
Xpath query
Hi all,
I am looking for a function that finds a string from a RSS feed and retrieve the whole content of the matched nodes values.
I've made unsuccessfull tests using fn:matches function.
Here is my PHP code ;
$document = new DOMDocument();
$document->preserveWhiteSpace = FALSE;
$document->load("soccer-rss.xml");
$xpath = new DOMXPath($document);
$string="Liga";
$markup="title";
$query = '/rss/channel/item/' . $markup .'[fn:matches(".","' . $string .'")]';
$results = $xpath->query($query);
...
In this example I wanted to retrieve titles containing the word "Liga" from RSS titles.
When submitting query /rss/channel/item/title[fn:matches(".","Liga")] my code displays all titles, even those not containing the word "Liga".
Does anyone have any idea to solve this ?
|
|
|
|