Getting content of the node which has childs via DOMDocument
Posted
by altern
on Stack Overflow
See other posts from Stack Overflow
or by altern
Published on 2010-06-03T14:30:06Z
Indexed on
2010/06/03
14:34 UTC
Read the original article
Hit count: 359
I have following html:
<html ><body >Body text <div >div content</div></body></html>
How could I get content of body without nested <div>
?
I need to get 'Body text', but do not have a clue how to do this.
result of running
$domhtml = DOMDocument::loadHTML($html);
print $domhtml->getElementsByTagName('body')->item(0)->nodeValue;
is 'Body textdiv content', which is not exactly what I want to get
© Stack Overflow or respective owner