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

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -