i have html code, xpath on it:
<b>random field:</b> <p> random field describes <a href="/index.php?page=glossary&term_id=230"> experiment</a> outcomes being functions of more 1 continuous variable, example u(x,y,z), x, y, , z coordinates in space. random field extension of concept of <a href="/index.php?page=glossary&term_id=598">random process</a> case of multivariate argument. </p> i tried take text inside <p> tag:
$dom = new domdocument(); $dom->loadhtml($curl_scraped_page); $xpath = new domxpath($dom); print $xpath->evaluate('string(//p[preceding::b]/text())'); but gave me this:
a random field describes what want is:
a random field describes ..(an on until).. of multivariate argument. i'm guessing problem lies on <a> tag. cause every time tried on same-patterned document, stops right before <a> tag. thanks..
this work:
$xpath->query('//p[preceding::b]')->item(0)->textcontent; there's string-join function in xpath, sadly not in xpath 1.0 version in lbxml php uses.
Comments
Post a Comment