php - How to get part of tag in Symfony Clawler -


$node item of $nodes array, foreach loop. $node contains this:

<tag class="troll">     <othertag> troll's hat </othertag>     troll <tag> 

i want use

$result = $node->filter(' tag.troll ??? ')->text(); 

to capture "troll" text without other tags.

should first remove childs of <tag> ? or maybe there selector filter() function ??

you can use xpath language , filter xpath method complex queries.
example, query $crawler->filterxpath('//tag[@class="troll"]/text()[last()]')->text()


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -