Source of: /manual/en/function.xml-set-processing-instruction-handler.php
<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.xml.inc";
$setup = array (
'home' =>
array (
0 => 'index.php',
1 => 'PHP Manual',
),
'head' =>
array (
0 => 'UTF-8',
1 => 'en',
),
'this' =>
array (
0 => 'function.xml-set-processing-instruction-handler.php',
1 => 'xml_set_processing_instruction_handler',
),
'up' =>
array (
0 => 'ref.xml.php',
1 => 'XML Parser Functions',
),
'prev' =>
array (
0 => 'function.xml-set-object.php',
1 => 'xml_set_object',
),
'next' =>
array (
0 => 'function.xml-set-start-namespace-decl-handler.php',
1 => 'xml_set_start_namespace_decl_handler',
),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);
manual_header();
?>
<div id="function.xml-set-processing-instruction-handler" class="refentry">
<div class="refnamediv">
<h1 class="refname">xml_set_processing_instruction_handler</h1>
<p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">xml_set_processing_instruction_handler</span> — <span class="dc-title">
Set up processing instruction (PI) handler
</span></p>
</div>
<a name="function.xml-set-processing-instruction-handler.description"></a><div class="refsect1 description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="type">bool</span> <span class="methodname"><b>xml_set_processing_instruction_handler</b></span>
( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$parser</tt></span>
, <span class="methodparam"><span class="type"><a href="language.pseudo-types.php#language.types.callback" class="type callback">callback</a></span> <tt class="parameter">$handler</tt></span>
)</div>
<p class="para rdfs-comment">
Sets the processing instruction (PI) handler function for the XML parser
<i><tt class="parameter">parser</tt></i>
.
</p>
<p class="para">
A processing instruction has the following format:
</p><div class="informalexample">
<div class="example-contents programlisting"><?<span class="replaceable">target</span>
<span class="replaceable">data</span>?><br />
</div>
</div><p>
You can put PHP code into such a tag, but be aware of one limitation: in
an XML PI, the PI end tag (<i>?></i>) can not be quoted,
so this character sequence should not appear in the PHP code you embed
with PIs in XML documents.If it does, the rest of the PHP code, as well
as the "real" PI end tag, will be treated as character data.
</p>
</div>
<a name="function.xml-set-processing-instruction-handler.parameters"></a><div class="refsect1 parameters">
<h3 class="title">Parameters</h3>
<p class="para">
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">parser</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
</p>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">handler</tt></i>
</span>
</dt><dd class="listitem">
<p class="para">
<i><tt class="parameter">handler</tt></i>
is a string containing the name of a
function that must exist when <a href="function.xml-parse.php" class="function">xml_parse()</a> is called
for <i><tt class="parameter">parser</tt></i>
.
</p>
<p class="para">
The function named by <i><tt class="parameter">handler</tt></i>
must accept
three parameters:
<div class="methodsynopsis dc-description">
<span class="methodname"><span class="replaceable">handler</span></span>
( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$parser</tt></span>
, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$target</tt></span>
, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$data</tt></span>
)</div>
</p><dl>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">parser</tt></i>
</span>
</dt><dd class="listitem">
<span class="simpara">
The first parameter, <span class="replaceable">parser</span>, is a
reference to the XML parser calling the handler.
</span>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">target</tt></i>
</span>
</dt><dd class="listitem">
<span class="simpara">
The second parameter, <i><tt class="parameter">target</tt></i>
, contains the PI
target.
</span>
</dd>
<dt class="varlistentry">
<span class="term"><i><tt class="parameter">data</tt></i>
</span>
</dt><dd class="listitem">
<span class="simpara">
The third parameter, <i><tt class="parameter">data</tt></i>
, contains the PI
data.
</span>
</dd>
</dl>
<p>
</p>
<p class="para">
If a handler function is set to an empty string, or <b><tt class="constant">FALSE</tt></b>, the handler
in question is disabled.
</p>
<blockquote><p><b class="note">Note</b>: <span class="simpara">Instead of a function name, an
array containing an object reference and a method name can also be
supplied.</span></p></blockquote>
</dd>
</dl>
<p>
</p>
</div>
<a name="function.xml-set-processing-instruction-handler.returnvalues"></a><div class="refsect1 returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
Returns <b><tt class="constant">TRUE</tt></b> on success or <b><tt class="constant">FALSE</tt></b> on failure.
</p>
</div>
</div><?php manual_footer(); ?>