reference/xml/functions/xml-set-element-handler.xml
5a14f904d231d294e2e5b4fb5d2fc4d2fd9eddee
...
...
@@ -1,6 +1,6 @@
1
1
<?xml version="1.0" encoding="utf-8"?>
2
2
<!-- $Revision$ -->
3
-
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.xml-set-element-handler">
3
+
<refentry xml:id="function.xml-set-element-handler" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>xml_set_element_handler</refname>
6
6
<refpurpose>Set up start and end element handlers</refpurpose>
...
...
@@ -9,17 +9,18 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>bool</type><methodname>xml_set_element_handler</methodname>
13
-
<methodparam><type>resource</type><parameter>parser</parameter></methodparam>
14
-
<methodparam><type>callable</type><parameter>start_element_handler</parameter></methodparam>
15
-
<methodparam><type>callable</type><parameter>end_element_handler</parameter></methodparam>
12
+
<type>true</type><methodname>xml_set_element_handler</methodname>
13
+
<methodparam><type>XMLParser</type><parameter>parser</parameter></methodparam>
14
+
<methodparam><type>callable</type><parameter>start_handler</parameter></methodparam>
15
+
<methodparam><type>callable</type><parameter>end_handler</parameter></methodparam>
16
16
</methodsynopsis>
17
17
<para>
18
18
Sets the element handler functions for the XML <parameter>parser</parameter>.
19
-
<parameter>start_element_handler</parameter> and
20
-
<parameter>end_element_handler</parameter> are strings containing
21
-
the names of functions that must exist when <function>xml_parse</function>
22
-
is called for <parameter>parser</parameter>.
19
+
</para>
20
+
<para>
21
+
<parameter>start_handler</parameter> is called when a new XML element is
22
+
opened. <parameter>end_handler</parameter> is called when an XML element
23
+
is closed.
23
24
</para>
24
25
</refsect1>
25
26

...
...
@@ -27,110 +28,79 @@
27
28
&reftitle.parameters;
28
29
<para>
29
30
<variablelist>
31
+
&xml.parser.param;
30
32
<varlistentry>
31
-
<term><parameter>parser</parameter></term>
33
+
<term><parameter>start_handler</parameter></term>
32
34
<listitem>
35
+
&xml.handler.description;
33
36
<para>
34
-
A reference to the XML parser to set up start and end element handler functions.
35
-
</para>
36
-
</listitem>
37
-
</varlistentry>
38
-
<varlistentry>
39
-
<term><parameter>start_element_handler</parameter></term>
40
-
<listitem>
41
-
<para>
42
-
The function named by <parameter>start_element_handler</parameter>
43
-
must accept three parameters:
37
+
The signature of the handler must be:
44
38
<methodsynopsis>
45
-
<methodname><replaceable>start_element_handler</replaceable></methodname>
46
-
<methodparam><type>resource</type><parameter>parser</parameter></methodparam>
39
+
<type>void</type><methodname><replaceable>start_element_handler</replaceable></methodname>
40
+
<methodparam><type>XMLParser</type><parameter>parser</parameter></methodparam>
47
41
<methodparam><type>string</type><parameter>name</parameter></methodparam>
48
-
<methodparam><type>array</type><parameter>attribs</parameter></methodparam>
42
+
<methodparam><type>array</type><parameter>attributes</parameter></methodparam>
49
43
</methodsynopsis>
50
44
<variablelist>
51
-
<varlistentry>
52
-
<term><parameter>parser</parameter></term>
53
-
<listitem>
54
-
<simpara>
55
-
The first parameter, <replaceable>parser</replaceable>, is a
56
-
reference to the XML parser calling the handler.
57
-
</simpara>
58
-
</listitem>
59
-
</varlistentry>
45
+
&xml.handler.parser.param;
60
46
<varlistentry>
61
47
<term><parameter>name</parameter></term>
62
48
<listitem>
63
49
<simpara>
64
-
The second parameter, <parameter>name</parameter>, contains the name
65
-
of the element for which this handler is called.If <link
66
-
linkend="xml.case-folding">case-folding</link> is in effect for this
67
-
parser, the element name will be in uppercase letters.
50
+
Contains the name of the element for which this handler is called.
51
+
If <link linkend="xml.case-folding">case-folding</link> is in effect
52
+
for this parser, the element name will be in uppercase letters.
68
53
</simpara>
69
54
</listitem>
70
55
</varlistentry>
71
56
<varlistentry>
72
-
<term><parameter>attribs</parameter></term>
57
+
<term><parameter>attributes</parameter></term>
73
58
<listitem>
74
59
<simpara>
75
-
The third parameter, <parameter>attribs</parameter>, contains an
76
-
associative array with the element's attributes (if any).The keys
77
-
of this array are the attribute names, the values are the attribute
78
-
values.Attribute names are <link
79
-
linkend="xml.case-folding">case-folded</link> on the same criteria as
80
-
element names.Attribute values are <emphasis>not</emphasis>
81
-
case-folded.
60
+
An associative array with the element's attributes.
61
+
The array is empty if the element has no attributes.
62
+
The keys of this array are the attribute names,
63
+
the values are the attribute values.
64
+
Attribute names are
65
+
<link linkend="xml.case-folding">case-folded</link>
66
+
on the same criteria as element names.
67
+
Attribute values are <emphasis>not</emphasis> case-folded.
82
68
</simpara>
83
69
<simpara>
84
-
The original order of the attributes can be retrieved by walking
85
-
through <parameter>attribs</parameter> the normal way, using
86
-
<function>each</function>.The first key in the array was the first
87
-
attribute, and so on.
70
+
The order in which <parameter>attributes</parameter> is traversed
71
+
is identical to the order in which the attributes were declared.
88
72
</simpara>
89
73
</listitem>
90
74
</varlistentry>
91
75
</variablelist>
92
76
</para>
93
-
&note.func-callback;
94
77
</listitem>
95
78
</varlistentry>
96
79
<varlistentry>
97
-
<term><parameter>end_element_handler</parameter></term>
80
+
<term><parameter>end_handler</parameter></term>
98
81
<listitem>
82
+
&xml.handler.description;
99
83
<para>
100
-
The function named by <parameter>end_element_handler</parameter>
101
-
must accept two parameters:
84
+
The signature of the handler must be:
102
85
<methodsynopsis>
103
-
<methodname><replaceable>end_element_handler</replaceable></methodname>
104
-
<methodparam><type>resource</type><parameter>parser</parameter></methodparam>
86
+
<type>void</type><methodname><replaceable>end_element_handler</replaceable></methodname>
87
+
<methodparam><type>XMLParser</type><parameter>parser</parameter></methodparam>
105
88
<methodparam><type>string</type><parameter>name</parameter></methodparam>
106
89
</methodsynopsis>
107
90
<variablelist>
108
-
<varlistentry>
109
-
<term><parameter>parser</parameter></term>
110
-
<listitem>
111
-
<simpara>
112
-
The first parameter, <replaceable>parser</replaceable>, is a
113
-
reference to the XML parser calling the handler.
114
-
</simpara>
115
-
</listitem>
116
-
</varlistentry>
91
+
&xml.handler.parser.param;
117
92
<varlistentry>
118
93
<term><parameter>name</parameter></term>
119
94
<listitem>
120
95
<simpara>
121
-
The second parameter, <parameter>name</parameter>, contains the name
122
-
of the element for which this handler is called.If <link
123
-
linkend="xml.case-folding">case-folding</link> is in effect for this
124
-
parser, the element name will be in uppercase letters.
96
+
Contains the name of the element for which this handler is called.
97
+
If <link linkend="xml.case-folding">case-folding</link> is in effect
98
+
for this parser, the element name will be in uppercase letters.
125
99
</simpara>
126
100
</listitem>
127
101
</varlistentry>
128
102
</variablelist>
129
103
</para>
130
-
<para>
131
-
If a handler function is set to an empty string, or &false;, the handler
132
-
in question is disabled.
133
-
</para>
134
104
</listitem>
135
105
</varlistentry>
136
106
</variablelist>
...
...
@@ -140,12 +110,28 @@
140
110
<refsect1 role="returnvalues">
141
111
&reftitle.returnvalues;
142
112
<para>
143
-
&return.success;
113
+
&return.true.always;
144
114
</para>
145
115
</refsect1>
146
116

147
-
</refentry>
117
+
<refsect1 role="changelog">
118
+
&reftitle.changelog;
119
+
<informaltable>
120
+
<tgroup cols="2">
121
+
<thead>
122
+
<row>
123
+
<entry>&Version;</entry>
124
+
<entry>&Description;</entry>
125
+
</row>
126
+
</thead>
127
+
<tbody>
128
+
&xml.changelog.parser-param;
129
+
</tbody>
130
+
</tgroup>
131
+
</informaltable>
132
+
</refsect1>
148
133

134
+
</refentry>
149
135
<!-- Keep this comment at the end of the file
150
136
Local variables:
151
137
mode: sgml
152
138