php - Xpath nodeValue/textContent unable to see <BR> tag -
html follows:
<a href="#">abc<br>def</a>
however, both nodevalue , textcontent attributes show "abcdef"
value.
any way show or parse <br>
?
maybe this'll you: domnode::c14n
it'll return html of node.
<?php $a = '<a href="#">abc<br>def</a>'; $doc = new domdocument(); @$doc->loadhtml($a); $finder = new domxpath($doc); $nodes = $finder->query("//a"); foreach ($nodes $node) { var_dump($node->c14n()); }
Comments
Post a Comment