I readed this DOMNode document and I found there isn't getelementsbytagname method in DOMNode. But, in my code I can use getelementsbytagname method with DOMNode. Can someone explain me why?
There is my code:
$dom = new DOMDocument;
@$dom->loadHTMLFile('http://www.poemjoy.com/show-8-27-1.html');
$xpath = new DOMXpath($dom);
$articles = $xpath->query('//div[@class="poem_detail"]');
foreach($articles as $tnode)
{
$ep=$tnode->getElementsByTagName('p');
}
The $tnode
is DOMNode type variable. I didn't find getelementsbytagname method in the document I mention before.Why can I use it?
Can someone please explain to me?