downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.xml-set-element-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-element-handler.php',
   
1 => 'xml_set_element_handler',
  ),
 
'up' =>
  array (
   
0 => 'ref.xml.php',
   
1 => 'XML Parser Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.xml-set-default-handler.php',
   
1 => 'xml_set_default_handler',
  ),
 
'next' =>
  array (
   
0 => 'function.xml-set-end-namespace-decl-handler.php',
   
1 => 'xml_set_end_namespace_decl_handler',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.xml-set-element-handler" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">xml_set_element_handler</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">xml_set_element_handler</span> &mdash; <span class="dc-title">Set up start and end element handlers</span></p>

 </div>
 
 <a name="function.xml-set-element-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_element_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">$start_element_handler</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">$end_element_handler</tt></span>
   )</div>

  <p class="para rdfs-comment">
   Sets the element handler functions for the XML <i><tt class="parameter">parser</tt></i>
.
   <i><tt class="parameter">start_element_handler</tt></i>
 and
   <i><tt class="parameter">end_element_handler</tt></i>
 are strings containing
   the names of functions 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>
 </div>


 <a name="function.xml-set-element-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">start_element_handler</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The function named by <i><tt class="parameter">start_element_handler</tt></i>

       must accept three parameters:
       <div class="methodsynopsis dc-description">
         <span class="methodname"><span class="replaceable">start_element_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">$name</tt></span>
        , <span class="methodparam"><span class="type">array</span> <tt class="parameter">$attribs</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">name</tt></i>
</span>

         </dt><dd class="listitem">

          <span class="simpara">
           The second parameter, <i><tt class="parameter">name</tt></i>
, contains the name
           of the element for which this handler is called.If <a href="xml.case-folding.php" class="link">case-folding</a> is in effect for this
           parser, the element name will be in uppercase letters.
          </span>
         </dd>

       
        <dt class="varlistentry">

         <span class="term"><i><tt class="parameter">attribs</tt></i>
</span>

         </dt><dd class="listitem">

          <span class="simpara">
           The third parameter, <i><tt class="parameter">attribs</tt></i>
, contains an
           associative array with the element&#039;s attributes (if any).The keys
           of this array are the attribute names, the values are the attribute
           values.Attribute names are <a href="xml.case-folding.php" class="link">case-folded</a> on the same criteria as
           element names.Attribute values are <em class="emphasis">not</em>
           case-folded.
          </span>
          <span class="simpara">
           The original order of the attributes can be retrieved by walking
           through <i><tt class="parameter">attribs</tt></i>
 the normal way, using
           <a href="function.each.php" class="function">each()</a>.The first key in the array was the first
           attribute, and so on.
          </span>
         </dd>

       
       </dl>
<p>
      </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>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">end_element_handler</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       The function named by <i><tt class="parameter">end_element_handler</tt></i>

       must accept two parameters:
       <div class="methodsynopsis dc-description">
         <span class="methodname"><span class="replaceable">end_element_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">$name</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">name</tt></i>
</span>

         </dt><dd class="listitem">

          <span class="simpara">
           The second parameter, <i><tt class="parameter">name</tt></i>
, contains the name
           of the element for which this handler is called.If <a href="xml.case-folding.php" class="link">case-folding</a> is in effect for this
           parser, the element name will be in uppercase letters.
          </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>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.xml-set-element-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(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites