cvs: phpdoc /en/reference/dom reference.xml /en/reference/dom/functions dom-domnode-appendchild.xml dom-domnode-hasattributes.xml
dom-domnode-haschildnodes.xml dom-domnode-removechild.xml dom-domnodelist-item.xml

From: Date: Mon, 20 Dec 2004 19:58:26 +0000
Subject: cvs: phpdoc /en/reference/dom reference.xml /en/reference/dom/functions dom-domnode-appendchild.xml dom-domnode-hasattributes.xml
dom-domnode-haschildnodes.xml dom-domnode-removechild.xml dom-domnodelist-item.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969365546@lists.php.net to get a copy of this message
didou Mon Dec 20 14:58:26 2004 EDT Modified files: /phpdoc/en/reference/dom reference.xml /phpdoc/en/reference/dom/functions dom-domnode-appendchild.xml dom-domnode-hasattributes.xml dom-domnode-haschildnodes.xml dom-domnode-removechild.xml dom-domnodelist-item.xml Log: Added most of the remaining properties descriptions Cleared 5 more methods

http://cvs.php.net/diff.php/phpdoc/en/reference/dom/reference.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc/en/reference/dom/reference.xml diff -u phpdoc/en/reference/dom/reference.xml:1.8 phpdoc/en/reference/dom/reference.xml:1.9 --- phpdoc/en/reference/dom/reference.xml:1.8 Sun Dec 19 17:16:43 2004 +++ phpdoc/en/reference/dom/reference.xml Mon Dec 20 14:58:24 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <reference id="ref.dom"> <title>DOM Functions</title> <titleabbrev>DOM</titleabbrev> @@ -289,19 +289,26 @@ <entry>doctype</entry> <entry>DOMDocumentType</entry> <entry>yes</entry> - <entry></entry> + <entry> + The Document Type Declaration associated with this document. + </entry> </row> <row> <entry>documentElement</entry> <entry>DOMElement</entry> <entry>yes</entry> - <entry></entry> + <entry> + This is a convenience attribute that allows direct access to the + child node that is the document element of the document. + </entry> </row> <row> <entry>documentURI</entry> <entry>string</entry> <entry>no</entry> - <entry></entry> + <entry> + The location of the document or &null; if undefined. + </entry> </row> <row> <entry>encoding</entry> @@ -319,7 +326,10 @@ <entry>implementation</entry> <entry>DOMImplementation</entry> <entry>yes</entry> - <entry></entry> + <entry> + The <classname>DOMImplementation</classname> object that handles + this document. + </entry> </row> <row> <entry>preserveWhiteSpace</entry> @@ -377,19 +387,30 @@ <entry>xmlEncoding</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry> + An attribute specifying, as part of the XML declaration, the + encoding of this document. This is &null; when unspecified or when it + is not known, such as when the Document was created in memory. + </entry> </row> <row> <entry>xmlStandalone</entry> <entry>bool</entry> <entry>no</entry> - <entry></entry> + <entry> + An attribute specifying, as part of the XML declaration, whether + this document is standalone. This is &false; when unspecified. + </entry> </row> <row> <entry>xmlVersion</entry> <entry>string</entry> <entry>no</entry> - <entry></entry> + <entry> + An attribute specifying, as part of the XML declaration, the + version number of this document. If there is no declaration and if + this document supports the "XML" feature, the value is "1.0". + </entry> </row> </tbody> </tgroup> @@ -402,6 +423,11 @@ <para> Extends <classname>DOMNode</classname> </para> + <para> + Each <classname>DOMDocument</classname> has a + <literal>doctype</literal> attribute whose value is either &null; or a + <classname>DOMDocumentType</classname> object. + </para> <section id='dom.class.domdocumenttype.properties'> &reftitle.properties; <table> @@ -420,37 +446,48 @@ <entry>publicId</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry>The public identifier of the external subset.</entry> </row> <row> <entry>systemId</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry>The system identifier of the external subset. This may be an + absolute URI or not.</entry> </row> <row> <entry>name</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry>The name of DTD; i.e., the name immediately following the + <literal>DOCTYPE</literal> keyword.</entry> </row> <row> <entry>entities</entry> <entry>DOMNamedNodeMap</entry> <entry>yes</entry> - <entry></entry> + <entry> + A <classname>DOMNamedNodeMap</classname> containing the general + entities, both external and internal, declared in the DTD. + </entry> </row> <row> <entry>notations</entry> <entry>DOMNamedNodeMap</entry> <entry>yes</entry> - <entry></entry> + <entry> + A <classname>DOMNamedNodeMap</classname> containing the notations + declared in the DTD. + </entry> </row> <row> <entry>internalSubset</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry> + The internal subset as a string, or null if there is none. This is + does not contain the delimiting square brackets. + </entry> </row> </tbody> </tgroup> @@ -550,6 +587,10 @@ <para> Extends <classname>DOMNode</classname> </para> + <para> + This interface represents a known entity, either parsed or unparsed, in + an XML document. + </para> <section id='dom.class.domentity.properties'> &reftitle.properties; <table> @@ -568,37 +609,59 @@ <entry>publicId</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry> + The public identifier associated with the entity if specified, and + &null; otherwise. + </entry> </row> <row> <entry>systemId</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry> + The system identifier associated with the entity if specified, and + &null; otherwise. This may be an absolute URI or not. + </entry> </row> <row> <entry>notationName</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry> + For unparsed entities, the name of the notation for the entity. For + parsed entities, this is &null;. + </entry> </row> <row> <entry>actualEncoding</entry> <entry>string</entry> <entry>no</entry> - <entry></entry> + <entry> + An attribute specifying the encoding used for this entity at the + time of parsing, when it is an external parsed entity. This is + &null; if it an entity from the internal subset or if it is not + known. + </entry> </row> <row> <entry>encoding</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry> + An attribute specifying, as part of the text declaration, the + encoding of this entity, when it is an external parsed entity. This + is &null; otherwise. + </entry> </row> <row> <entry>version</entry> <entry>string</entry> - <entry>no</entry> - <entry></entry> + <entry>yes</entry> + <entry> + An attribute specifying, as part of the text declaration, the + version number of this entity, when it is an external parsed + entity. This is &null; otherwise. + </entry> </row> </tbody> </tgroup> @@ -706,7 +769,11 @@ <entry>length</entry> <entry>int</entry> <entry>yes</entry> - <entry></entry> + <entry> + The number of pairs (name and namespaceURI) in the list. The range + of valid child node indices is 0 to <literal>length - 1</literal> + inclusive. + </entry> </row> </tbody> </tgroup> @@ -782,7 +849,7 @@ <entry>nodeValue</entry> <entry>string</entry> <entry>no</entry> - <entry></entry> + <entry>The value of this node, depending on its type.</entry> </row> <row> <entry>nodeType</entry> @@ -794,79 +861,114 @@ <entry>parentNode</entry> <entry>DOMNode</entry> <entry>yes</entry> - <entry></entry> + <entry>The parent of this node.</entry> </row> <row> <entry>childNodes</entry> <entry>DOMNodeList</entry> <entry>yes</entry> - <entry></entry> + <entry> + A <classname>DOMNodeList</classname> that contains all children of + this node. If there are no children, this is an empty + <classname>DOMNodeList</classname>. + </entry> </row> <row> <entry>firstChild</entry> <entry>DOMNode</entry> <entry>yes</entry> - <entry></entry> + <entry> + The first child of this node. If there is no such node, this + returns &null;. + </entry> </row> <row> <entry>lastChild</entry> <entry>DOMNode</entry> <entry>yes</entry> - <entry></entry> + <entry> + The last child of this node. If there is no such node, this returns + &null;. + </entry> </row> <row> <entry>previousSibling</entry> <entry>DOMNode</entry> <entry>yes</entry> - <entry></entry> + <entry> + The node immediately preceding this node. If there is no such node, + this returns &null;. + </entry> </row> <row> <entry>nextSibling</entry> <entry>DOMNode</entry> <entry>yes</entry> - <entry></entry> + <entry> + The node immediately following this node. If there is no such node, + this returns &null;. + </entry> </row> <row> <entry>attributes</entry> - <entry>DomNamedNodeMap</entry> + <entry>DOMNamedNodeMap</entry> <entry>yes</entry> - <entry></entry> + <entry> + A <classname>DOMNamedNodeMap</classname> containing the attributes + of this node (if it is a <classname>DOMElement</classname>) or + &null; otherwise. + </entry> </row> <row> <entry>ownerDocument</entry> <entry>DOMDocument</entry> <entry>yes</entry> - <entry></entry> + <entry> + The <classname>DOMDocument</classname> object associated with this + node. + </entry> </row> <row> <entry>namespaceURI</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry> + The namespace URI of this node, or &null; if it is unspecified. + </entry> </row> <row> <entry>prefix</entry> <entry>string</entry> <entry>no</entry> - <entry></entry> + <entry> + The namespace prefix of this node, or &null; if it is unspecified. + </entry> </row> <row> <entry>localName</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry> + Returns the local part of the qualified name of this node. + </entry> </row> <row> <entry>baseURI</entry> <entry>string</entry> <entry>yes</entry> - <entry></entry> + <entry> + The absolute base URI of this node or &null; if the implementation + wasn't able to obtain an absolute URI. + </entry> </row> <row> <entry>textContent</entry> <entry>string</entry> <entry>no</entry> - <entry></entry> + <entry> + This attribute returns the text content of this node and its + descendants. + </entry> </row> </tbody> </tgroup> http://cvs.php.net/diff.php/phpdoc/en/reference/dom/functions/dom-domnode-appendchild.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc/en/reference/dom/functions/dom-domnode-appendchild.xml diff -u phpdoc/en/reference/dom/functions/dom-domnode-appendchild.xml:1.4 phpdoc/en/reference/dom/functions/dom-domnode-appendchild.xml:1.5 --- phpdoc/en/reference/dom/functions/dom-domnode-appendchild.xml:1.4 Fri Dec 17 10:11:30 2004 +++ phpdoc/en/reference/dom/functions/dom-domnode-appendchild.xml Mon Dec 20 14:58:25 2004 @@ -1,50 +1,86 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> - <refentry id='function.dom-domnode-appendchild'> - <refnamediv> - <refname>DOMNode->appendChild</refname> - <refpurpose> - Adds new child at the end of the children - </refpurpose> - </refnamediv> - <refsect1> - &reftitle.description; - <classsynopsis> - <ooclass><classname>DOMNode</classname></ooclass> - <methodsynopsis> - <type>DOMNode</type> - <methodname>appendChild</methodname> - <methodparam><type>DOMNode</type><parameter>newnode</parameter></methodparam> - </methodsynopsis> - </classsynopsis> - <para> - This functions appends a child to an existing list of children or creates - a new list of children. The child can be created with e.g. - <link linkend="function.dom-domdocument-createelement">DOMDocument->createElement()</link>, - <link linkend="function.dom-domdocument-createtextnode">DOMDocument->createTextNode()</link> - etc. or simply by using any other node. - </para> - <para> - Throws <classname>DOMException</classname> if node cannot be appended. - </para> - <para> - The following example will add a new element node to a fresh document. - <example> - <title>Adding a child</title> - <programlisting role="php"> +<!-- $Revision: 1.5 $ --> +<refentry id='function.dom-domnode-appendchild'> + <refnamediv> + <refname>DOMNode->appendChild</refname> + <refpurpose> + Adds new child at the end of the children + </refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <classsynopsis> + <ooclass><classname>DOMNode</classname></ooclass> + <methodsynopsis> + <type>DOMNode</type> + <methodname>appendChild</methodname> + <methodparam><type>DOMNode</type><parameter>newnode</parameter></methodparam> + </methodsynopsis> + </classsynopsis> + <para> + This functions appends a child to an existing list of children or creates + a new list of children. The child can be created with e.g. + <link linkend="function.dom-domdocument-createelement">DOMDocument->createElement()</link>, + <link linkend="function.dom-domdocument-createtextnode">DOMDocument->createTextNode()</link> + etc. or simply by using any other node. + </para> + <para> + Throws <classname>DOMException</classname> if the node cannot be appended. + </para> + </refsect1> + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>newnode</parameter></term> + <listitem> + <para> + The appended child. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + The node added. + </para> + </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + The following example will add a new element node to a fresh document. + <example> + <title>Adding a child</title> + <programlisting role="php"> <![CDATA[ <?php -$doc = new DOMDocument(); + +$doc = new DOMDocument; + $node = $doc->createElement("para"); $newnode = $doc->appendChild($node); -print $doc->saveXML(); + +echo $doc->saveXML(); ?> ]]> - </programlisting> - </example> - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><link linkend="function.dom-domnode-removechild">DOMNode->removeChild()</link></member> + <member><link linkend="function.dom-domnode-replacechild">DOMNode->replaceChild()</link></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc/en/reference/dom/functions/dom-domnode-hasattributes.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc/en/reference/dom/functions/dom-domnode-hasattributes.xml diff -u phpdoc/en/reference/dom/functions/dom-domnode-hasattributes.xml:1.3 phpdoc/en/reference/dom/functions/dom-domnode-hasattributes.xml:1.4 --- phpdoc/en/reference/dom/functions/dom-domnode-hasattributes.xml:1.3 Fri Dec 17 10:11:30 2004 +++ phpdoc/en/reference/dom/functions/dom-domnode-hasattributes.xml Mon Dec 20 14:58:25 2004 @@ -1,27 +1,33 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> - <refentry id='function.dom-domnode-hasattributes'> - <refnamediv> - <refname>DOMNode->hasAttributes</refname> - <refpurpose> - Checks if node has attributes - </refpurpose> - </refnamediv> - <refsect1> - &reftitle.description; - <classsynopsis> - <ooclass><classname>DOMNode</classname></ooclass> - <methodsynopsis> - <type>bool</type> - <methodname>hasAttributes</methodname> - <void/> - </methodsynopsis> - </classsynopsis> - <para> - This function checks if the node has attributes. - </para> - </refsect1> - </refentry> +<!-- $Revision: 1.4 $ --> +<refentry id='function.dom-domnode-hasattributes'> + <refnamediv> + <refname>DOMNode->hasAttributes</refname> + <refpurpose> + Checks if node has attributes + </refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <classsynopsis> + <ooclass><classname>DOMNode</classname></ooclass> + <methodsynopsis> + <type>bool</type> + <methodname>hasAttributes</methodname> + <void/> + </methodsynopsis> + </classsynopsis> + <para> + This function checks if the node has attributes. + </para> + </refsect1> + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + &return.success; + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc/en/reference/dom/functions/dom-domnode-haschildnodes.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc/en/reference/dom/functions/dom-domnode-haschildnodes.xml diff -u phpdoc/en/reference/dom/functions/dom-domnode-haschildnodes.xml:1.3 phpdoc/en/reference/dom/functions/dom-domnode-haschildnodes.xml:1.4 --- phpdoc/en/reference/dom/functions/dom-domnode-haschildnodes.xml:1.3 Fri Dec 17 10:11:30 2004 +++ phpdoc/en/reference/dom/functions/dom-domnode-haschildnodes.xml Mon Dec 20 14:58:25 2004 @@ -1,27 +1,33 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> - <refentry id='function.dom-domnode-haschildnodes'> - <refnamediv> - <refname>DOMNode->hasChildNodes</refname> - <refpurpose> - Checks if node has children - </refpurpose> - </refnamediv> - <refsect1> - &reftitle.description; - <classsynopsis> - <ooclass><classname>DOMNode</classname></ooclass> - <methodsynopsis> - <type>bool</type> - <methodname>hasChildNodes</methodname> - <void/> - </methodsynopsis> - </classsynopsis> - <para> - This function checks if the node has children. - </para> - </refsect1> - </refentry> +<!-- $Revision: 1.4 $ --> +<refentry id='function.dom-domnode-haschildnodes'> + <refnamediv> + <refname>DOMNode->hasChildNodes</refname> + <refpurpose> + Checks if node has children + </refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <classsynopsis> + <ooclass><classname>DOMNode</classname></ooclass> + <methodsynopsis> + <type>bool</type> + <methodname>hasChildNodes</methodname> + <void/> + </methodsynopsis> + </classsynopsis> + <para> + This function checks if the node has children. + </para> + </refsect1> + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + &return.success; + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc/en/reference/dom/functions/dom-domnode-removechild.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc/en/reference/dom/functions/dom-domnode-removechild.xml diff -u phpdoc/en/reference/dom/functions/dom-domnode-removechild.xml:1.4 phpdoc/en/reference/dom/functions/dom-domnode-removechild.xml:1.5 --- phpdoc/en/reference/dom/functions/dom-domnode-removechild.xml:1.4 Fri Dec 17 10:11:30 2004 +++ phpdoc/en/reference/dom/functions/dom-domnode-removechild.xml Mon Dec 20 14:58:25 2004 @@ -1,31 +1,96 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> - <refentry id='function.dom-domnode-removechild'> - <refnamediv> - <refname>DOMNode->removeChild</refname> - <refpurpose> - Removes child from list of children - </refpurpose> - </refnamediv> - <refsect1> - &reftitle.description; - <classsynopsis> - <ooclass><classname>DOMNode</classname></ooclass> - <methodsynopsis> - <type>DOMNode</type> - <methodname>removeChild</methodname> - <methodparam><type>DOMNode</type><parameter>oldchild</parameter></methodparam> - </methodsynopsis> - </classsynopsis> - <para> - This functions removes a child from a list of children. - If the child could be removed the functions returns the old child. - </para> - <para> - Throws <classname>DOMException</classname> if node cannot be removed. - </para> - </refsect1> - </refentry> +<!-- $Revision: 1.5 $ --> +<refentry id='function.dom-domnode-removechild'> + <refnamediv> + <refname>DOMNode->removeChild</refname> + <refpurpose> + Removes child from list of children + </refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <classsynopsis> + <ooclass><classname>DOMNode</classname></ooclass> + <methodsynopsis> + <type>DOMNode</type> + <methodname>removeChild</methodname> + <methodparam><type>DOMNode</type><parameter>oldnode</parameter></methodparam> + </methodsynopsis> + </classsynopsis> + <para> + This functions removes a child from a list of children. + </para> + <para> + Throws <classname>DOMException</classname> if the node cannot be removed. + </para> + </refsect1> + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>oldnode</parameter></term> + <listitem> + <para> + The removed child. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + If the child could be removed the functions returns the old child. + </para> + </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + The following example will delete the chapter element of our XML document. + <example> + <title>Removing a child</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$doc = new DOMDocument; +$doc->load('book.xml'); + +$book = $doc->documentElement; + +// we retrieve the chapter and remove it from the book +$chapter = $book->getElementsByTagName('chapter')->item(0); +$oldchapter = $book->removeChild($chapter); + +echo $doc->saveXML(); +?>]]> + </programlisting> + &example.outputs; + <screen role="xml"> +<![CDATA[ +<?xml version="1.0" encoding="iso-8859-1"?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd"> +<book id="listing"> + <title>My lists</title> + +</book> +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><link linkend="function.dom-domnode-appendchild">DOMNode->appendChild()</link></member> + <member><link linkend="function.dom-domnode-replacechild">DOMNode->replaceChild()</link></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc/en/reference/dom/functions/dom-domnodelist-item.xml?r1=1.5&r2=1.6&ty=u Index: phpdoc/en/reference/dom/functions/dom-domnodelist-item.xml diff -u phpdoc/en/reference/dom/functions/dom-domnodelist-item.xml:1.5 phpdoc/en/reference/dom/functions/dom-domnodelist-item.xml:1.6 --- phpdoc/en/reference/dom/functions/dom-domnodelist-item.xml:1.5 Fri Dec 17 10:11:30 2004 +++ phpdoc/en/reference/dom/functions/dom-domnodelist-item.xml Mon Dec 20 14:58:25 2004 @@ -1,28 +1,117 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> - <refentry id='function.dom-domnodelist-item'> - <refnamediv> - <refname>DOMNodelist->item</refname> - <refpurpose> - Retrieves a node specified by index - </refpurpose> - </refnamediv> - <refsect1> - &reftitle.description; - <classsynopsis> - <ooclass><classname>DOMNodeList</classname></ooclass> - <methodsynopsis> - <type>DOMNode</type> - <methodname>item</methodname> - <methodparam><type>int</type><parameter>index</parameter></methodparam> - </methodsynopsis> - </classsynopsis> +<!-- $Revision: 1.6 $ --> +<refentry id='function.dom-domnodelist-item'> + <refnamediv> + <refname>DOMNodelist->item</refname> + <refpurpose> + Retrieves a node specified by index + </refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <classsynopsis> + <ooclass><classname>DOMNodeList</classname></ooclass> + <methodsynopsis> + <type>DOMNode</type> + <methodname>item</methodname> + <methodparam><type>int</type><parameter>index</parameter></methodparam> + </methodsynopsis> + </classsynopsis> + <para> + Retrieves a node specified by <parameter>index</parameter> within the + <classname>DOMNodeList</classname> object. + </para> + <tip> + <para> + If you need to know the number of nodes in the collection, use + the <literal>length</literal> property of the + <classname>DOMNodeList</classname> object. + </para> + </tip> + </refsect1> + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>index</parameter></term> + <listitem> + <para> + Index of the node into the collection. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + The node at the <parameter>index</parameter>th position in the + <classname>DOMNodeList</classname>, or &null; if that is not a valid + index. + </para> + </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Traversing all the entries of the table</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$doc = new DOMDocument; +$doc->load('book.xml'); + +$items = $doc->getElementsByTagName('entry'); + +for ($i = 0; $i < $items->length; $i++) { + echo $items->item($i)->nodeValue . "\n"; +} + +?> +]]> + </programlisting> <para> - Retrieves a node specified by <parameter>index</parameter> within the - DOMNodeList object. + Alternatively, you can use foreach, which is a much more convenient way: </para> - </refsect1> - </refentry> + <programlisting role="php"> +<![CDATA[ +<?php + +foreach ($items as $item) { + echo $item->nodeValue . "\n"; +} + +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +Title +Author +Language +ISBN +The Grapes of Wrath +John Steinbeck +en +0140186409 +The Pearl +John Steinbeck +en +014017737X +Samarcande +Amine Maalouf +fr +2253051209 +]]> + </screen> + </example> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables:
« previous php.doc (#969365546) next »