From ed1765af8211e8fae2739f689a88e52b05ad2bb7 Mon Sep 17 00:00:00 2001 From: Gordon Oheim Date: Sat, 21 Jan 2012 11:47:57 +0000 Subject: [PATCH] Clarified that this method matches on the local tag name and added basic usage example git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@322539 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../dom/domdocument/getelementsbytagname.xml | 50 +++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/reference/dom/domdocument/getelementsbytagname.xml b/reference/dom/domdocument/getelementsbytagname.xml index 26ea3fa1a3..61e51d5dcd 100644 --- a/reference/dom/domdocument/getelementsbytagname.xml +++ b/reference/dom/domdocument/getelementsbytagname.xml @@ -3,7 +3,7 @@ DOMDocument::getElementsByTagName - Searches for all elements with given tag name + Searches for all elements with given local tag name &reftitle.description; @@ -13,8 +13,8 @@ This function returns a new instance of class - DOMNodeList containing the elements with a given - tag name. + DOMNodeList containing all the elements with a given + local tag name. @@ -25,8 +25,8 @@ name - The name of the tag to match on. The special value * - matches all tags. + The local name (without namespace) of the tag to match on. The special value * + matches all tags. @@ -40,6 +40,46 @@ elements. + + &reftitle.examples; + + + Basic Usage Example + + + + + + + Patterns of Enterprise Application Architecture + Design Patterns: Elements of Reusable Software Design + Clean Code + +XML; + +$dom = new DOMDocument; +$dom->loadXml($xml); +$books = $dom->getElementsByTagName('book'); +foreach ($books as $book) { + echo $book->nodeValue, PHP_EOL; +} +?> +]]> + + &example.outputs.similar; + + + + + + &reftitle.seealso;