how can I get the text data of a div without the child divs text data - with php xpath? -
<div class="date"> <div class="rating">good</div> movie review - mar 24, 2013 </div> <div class="date"> movie review - mar 23, 2013 </div>
what xpath query "movie review .." part without rating div content (where says good). rating div present not.
i tried sort of thing when div node $reviewnode:
$thedate = $xpath->query('text()[1]',$reviewdate)->item(0) ;
but catches rating div contents too.
the parsed doc html5.
this should return divs' text children contain string "movie":
//div[@class = "date"]/text()[contains(., "movie")]
if want first non-whitespace text node, can use
//div[@class = "date"]/text()[normalize-space(.) != ''][1]
Comments
Post a Comment