reference/xml/functions/xml-set-processing-instruction-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-processing-instruction-handler">
3
+
<refentry xml:id="function.xml-set-processing-instruction-handler" xmlns="http://docbook.org/ns/docbook">
4
4
<refnamediv>
5
5
<refname>xml_set_processing_instruction_handler</refname>
6
6
<refpurpose>
...
...
@@ -11,8 +11,8 @@
11
11
<refsect1 role="description">
12
12
&reftitle.description;
13
13
<methodsynopsis>
14
-
<type>bool</type><methodname>xml_set_processing_instruction_handler</methodname>
15
-
<methodparam><type>resource</type><parameter>parser</parameter></methodparam>
14
+
<type>true</type><methodname>xml_set_processing_instruction_handler</methodname>
15
+
<methodparam><type>XMLParser</type><parameter>parser</parameter></methodparam>
16
16
<methodparam><type>callable</type><parameter>handler</parameter></methodparam>
17
17
</methodsynopsis>
18
18
<para>
...
...
@@ -21,64 +21,52 @@
21
21
</para>
22
22
<para>
23
23
A processing instruction has the following format:
24
-
<informalexample>
25
-
<programlisting>&lt;?<replaceable>target</replaceable>
26
-
<replaceable>data</replaceable>?>
27
-
</programlisting>
28
-
</informalexample>
29
-
You can put PHP code into such a tag, but be aware of one limitation: in
30
-
an XML PI, the PI end tag (<literal>?&gt;</literal>) can not be quoted,
31
-
so this character sequence should not appear in the PHP code you embed
32
-
with PIs in XML documents.If it does, the rest of the PHP code, as well
33
-
as the "real" PI end tag, will be treated as character data.
24
+
<programlisting role="xml">
25
+
<![CDATA[
26
+
<?target
27
+
data
28
+
?>
29
+
]]>
30
+
</programlisting>
34
31
</para>
32
+
<caution>
33
+
<para>
34
+
PHP code is delimited by the <literal>&lt;?php</literal>
35
+
processing instruction.
36
+
As such it is possible to have PHP code within an XML document.
37
+
However, the PI end tag (<literal>?&gt;</literal>) must not be part of
38
+
the data.
39
+
If a PI end tag exists as part of the embedded PHP code,
40
+
the rest of the PHP code and the "real" PI end tag, will be treated
41
+
as character data.
42
+
</para>
43
+
</caution>
35
44
</refsect1>
36
45

37
46
<refsect1 role="parameters">
38
47
&reftitle.parameters;
39
48
<para>
40
49
<variablelist>
41
-
<varlistentry>
42
-
<term><parameter>parser</parameter></term>
43
-
<listitem>
44
-
<para>
45
-
A reference to the XML parser to set up processing instruction (PI) handler function.
46
-
</para>
47
-
</listitem>
48
-
</varlistentry>
50
+
&xml.parser.param;
49
51
<varlistentry>
50
52
<term><parameter>handler</parameter></term>
51
53
<listitem>
54
+
&xml.handler.description;
52
55
<para>
53
-
<parameter>handler</parameter> is a string containing the name of a
54
-
function that must exist when <function>xml_parse</function> is called
55
-
for <parameter>parser</parameter>.
56
-
</para>
57
-
<para>
58
-
The function named by <parameter>handler</parameter> must accept
59
-
three parameters:
56
+
The signature of the handler must be:
60
57
<methodsynopsis>
61
-
<methodname><replaceable>handler</replaceable></methodname>
62
-
<methodparam><type>resource</type><parameter>parser</parameter></methodparam>
58
+
<type>void</type><methodname><replaceable>handler</replaceable></methodname>
59
+
<methodparam><type>XMLParser</type><parameter>parser</parameter></methodparam>
63
60
<methodparam><type>string</type><parameter>target</parameter></methodparam>
64
61
<methodparam><type>string</type><parameter>data</parameter></methodparam>
65
62
</methodsynopsis>
66
63
<variablelist>
67
-
<varlistentry>
68
-
<term><parameter>parser</parameter></term>
69
-
<listitem>
70
-
<simpara>
71
-
The first parameter, <replaceable>parser</replaceable>, is a
72
-
reference to the XML parser calling the handler.
73
-
</simpara>
74
-
</listitem>
75
-
</varlistentry>
64
+
&xml.handler.parser.param;
76
65
<varlistentry>
77
66
<term><parameter>target</parameter></term>
78
67
<listitem>
79
68
<simpara>
80
-
The second parameter, <parameter>target</parameter>, contains the PI
81
-
target.
69
+
The processing instruction target.
82
70
</simpara>
83
71
</listitem>
84
72
</varlistentry>
...
...
@@ -86,18 +74,12 @@
86
74
<term><parameter>data</parameter></term>
87
75
<listitem>
88
76
<simpara>
89
-
The third parameter, <parameter>data</parameter>, contains the PI
90
-
data.
77
+
The processing instruction data.
91
78
</simpara>
92
79
</listitem>
93
80
</varlistentry>
94
81
</variablelist>
95
82
</para>
96
-
<para>
97
-
If a handler function is set to an empty string, or &false;, the handler
98
-
in question is disabled.
99
-
</para>
100
-
&note.func-callback;
101
83
</listitem>
102
84
</varlistentry>
103
85
</variablelist>
...
...
@@ -107,12 +89,28 @@
107
89
<refsect1 role="returnvalues">
108
90
&reftitle.returnvalues;
109
91
<para>
110
-
&return.success;
92
+
&return.true.always;
111
93
</para>
112
94
</refsect1>
113
95

114
-
</refentry>
96
+
<refsect1 role="changelog">
97
+
&reftitle.changelog;
98
+
<informaltable>
99
+
<tgroup cols="2">
100
+
<thead>
101
+
<row>
102
+
<entry>&Version;</entry>
103
+
<entry>&Description;</entry>
104
+
</row>
105
+
</thead>
106
+
<tbody>
107
+
&xml.changelog.parser-param;
108
+
</tbody>
109
+
</tgroup>
110
+
</informaltable>
111
+
</refsect1>
115
112

113
+
</refentry>
116
114
<!-- Keep this comment at the end of the file
117
115
Local variables:
118
116
mode: sgml
119
117