PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

DOMDocument::getElementsByTagNameNS> <DOMDocument::getElementById
Last updated: Fri, 10 Oct 2008

view this page in

DOMDocument::getElementsByTagName

(No version information available, might be only in CVS)

DOMDocument::getElementsByTagName指定したタグ名に対応するすべての要素を検索する

説明

DOMNodeList DOMDocument::getElementsByTagName ( string $name )

この関数は、指定したタグ名の要素を含む DOMNodeList クラスの新しいインスタンスを返します。

パラメータ

name

タグ名に一致する名前。* はすべてのタグに一致します。

返り値

一致するすべての要素を含む、新しい DOMNodeList オブジェクトを返します。



add a note add a note User Contributed Notes
DOMDocument::getElementsByTagName
James L
19-Aug-2008 01:04
Return if there are no matches is an empty DOMNodeList. Check using length property, e.g.:

<?php
$nodes
=$domDocument->getElementsByTagName('book') ;
if (
$nodes->length==0) {
  
// no results
}
?>

 
show source | credits | sitemap | contact | advertising | mirror sites