svn: /phpdoc/en/trunk/reference/dom/domdocument/ getelementsbytagname.xml

From: Date: Sat, 21 Jan 2012 11:47:57 +0000
Subject: svn: /phpdoc/en/trunk/reference/dom/domdocument/ getelementsbytagname.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-9478@lists.php.net to get a copy of this message
gooh Sat, 21 Jan 2012 11:47:57 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=322539 Log: Clarified that this method matches on the local tag name and added basic usage example Changed paths: U phpdoc/en/trunk/reference/dom/domdocument/getelementsbytagname.xml Modified: phpdoc/en/trunk/reference/dom/domdocument/getelementsbytagname.xml =================================================================== --- phpdoc/en/trunk/reference/dom/domdocument/getelementsbytagname.xml 2012-01-21 11:43:44 UTC (rev 322538) +++ phpdoc/en/trunk/reference/dom/domdocument/getelementsbytagname.xml 2012-01-21 11:47:57 UTC (rev 322539) @@ -3,7 +3,7 @@ <refentry xml:id="domdocument.getelementsbytagname" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>DOMDocument::getElementsByTagName</refname> - <refpurpose>Searches for all elements with given tag name</refpurpose> + <refpurpose>Searches for all elements with given local tag name</refpurpose> </refnamediv> <refsect1 role="description"> &reftitle.description; @@ -13,8 +13,8 @@ </methodsynopsis> <para> This function returns a new instance of class - <classname>DOMNodeList</classname> containing the elements with a given - tag name. + <classname>DOMNodeList</classname> containing all the elements with a given + local tag name. </para> </refsect1> <refsect1 role="parameters"> @@ -25,8 +25,8 @@ <term><parameter>name</parameter></term> <listitem> <para> - The name of the tag to match on. The special value <literal>*</literal> - matches all tags. + The local name (without namespace) of the tag to match on. The special value <literal>*</literal> + matches all tags. </para> </listitem> </varlistentry> @@ -40,6 +40,46 @@ elements. </para> </refsect1> + <refsect1 role="examples"><!-- {{{ --> + &reftitle.examples; + <para> + <example xml:id="domdocument.getelementsbytagname.example.basic"><!-- {{{ --> + <title>Basic Usage Example</title> + <para> + + </para> + <programlisting role="php"> +<![CDATA[ +<?php +$xml = <<< XML +<?xml version="1.0" encoding="utf-8"?> +<books> + <book>Patterns of Enterprise Application Architecture</book> + <book>Design Patterns: Elements of Reusable Software Design</book> + <book>Clean Code</book> +</books> +XML; + +$dom = new DOMDocument; +$dom->loadXml($xml); +$books = $dom->getElementsByTagName('book'); +foreach ($books as $book) { + echo $book->nodeValue, PHP_EOL; +} +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Patterns of Enterprise Application Architecture +Design Patterns: Elements of Reusable Software Design +Clean Code +]]> + </screen> + </example><!-- }}} --> + </para> + </refsect1><!-- }}} --> <refsect1 role="seealso"> &reftitle.seealso; <para>

« previous php.doc.cvs (#9478) next »