reference/simplexml/simplexmlelement/xpath.xml
770c6facae667218f69c8ea2715ea20f6fab32f3
...
...
@@ -8,13 +8,13 @@
8
8
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
-
<methodsynopsis>
12
-
<modifier>public</modifier> <type>array</type><methodname>SimpleXMLElement::xpath</methodname>
13
-
<methodparam><type>string</type><parameter>path</parameter></methodparam>
11
+
<methodsynopsis role="SimpleXMLElement">
12
+
<modifier>public</modifier> <type class="union"><type>array</type><type>null</type><type>false</type></type><methodname>SimpleXMLElement::xpath</methodname>
13
+
<methodparam><type>string</type><parameter>expression</parameter></methodparam>
14
14
</methodsynopsis>
15
15
<para>
16
16
The <literal>xpath</literal> method searches the SimpleXML node for
17
-
children matching the <acronym>XPath</acronym> <parameter>path</parameter>.
17
+
children matching the <acronym>XPath</acronym> <parameter>expression</parameter>.
18
18
</para>
19
19
</refsect1>
20
20

...
...
@@ -23,7 +23,7 @@
23
23
<para>
24
24
<variablelist>
25
25
<varlistentry>
26
-
<term><parameter>path</parameter></term>
26
+
<term><parameter>expression</parameter></term>
27
27
<listitem>
28
28
<para>
29
29
An XPath path
...
...
@@ -37,7 +37,7 @@
37
37
<refsect1 role="returnvalues">
38
38
&reftitle.returnvalues;
39
39
<para>
40
-
Returns an <type>array</type> of SimpleXMLElement objects or &false; in
40
+
Returns an <type>array</type> of SimpleXMLElement objects on success; or &null; or &false; in
41
41
case of an error.
42
42
</para>
43
43
</refsect1>
...
...
@@ -67,14 +67,14 @@ $xml = new SimpleXMLElement($string);
67
67
/* Search for <a><b><c> */
68
68
$result = $xml->xpath('/a/b/c');
69
69

70
-
while(list( , $node) = each($result)) {
70
+
foreach ($result as $node) {
71
71
echo '/a/b/c: ',$node,"\n";
72
72
}
73
73

74
74
/* Relative paths also work... */
75
75
$result = $xml->xpath('b/c');
76
76

77
-
while(list( , $node) = each($result)) {
77
+
foreach ($result as $node) {
78
78
echo 'b/c: ',$node,"\n";
79
79
}
80
80
?>
...
...
@@ -109,7 +109,6 @@ b/c: stuff
109
109
</refsect1>
110
110

111
111
</refentry>
112
-

113
112
<!-- Keep this comment at the end of the file
114
113
Local variables:
115
114
mode: sgml
116
115