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
Post a Comment