Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 6636

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Set up start and end element handlers</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.xml-set-default-handler.html">xml_set_default_handler</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.xml-set-end-namespace-decl-handler.html">xml_set_end_namespace_decl_handler</a></div>
 <div class="up"><a href="ref.xml.html">XML Parser Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><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>
 
 <div class="refsect1 description" id="refsect1-function.xml-set-element-handler-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><strong>xml_set_element_handler</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$parser</code></span>
   , <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$start_element_handler</code></span>
   , <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$end_element_handler</code></span>
   )</div>

  <p class="para rdfs-comment">
   Sets the element handler functions for the XML <em><code class="parameter">parser</code></em>.
   <em><code class="parameter">start_element_handler</code></em> and
   <em><code class="parameter">end_element_handler</code></em> are strings containing
   the names of functions that must exist when  <span class="function"><a href="function.xml-parse.html" class="function">xml_parse()</a></span>
   is called for <em><code class="parameter">parser</code></em>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.xml-set-element-handler-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">parser</code></em></span>
     <dd>

      <p class="para">
       A reference to the XML parser to set up start and end element handler functions.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">start_element_handler</code></em></span>
     <dd>

      <p class="para">
       The function named by <em><code class="parameter">start_element_handler</code></em>
       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> <code class="parameter">$parser</code></span>
        , <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
        , <span class="methodparam"><span class="type">array</span> <code class="parameter">$attribs</code></span>
        )</div>

       <dl>

        <dt>

         <span class="term"><em><code class="parameter">parser</code></em></span> 
         <dd>

          <span class="simpara">
           The first parameter, <span class="replaceable">parser</span>, is a
           reference to the XML parser calling the handler.
          </span>
         </dd>

        </dt>

        <dt>

         <span class="term"><em><code class="parameter">name</code></em></span>
         <dd>

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

        </dt>

        <dt>

         <span class="term"><em><code class="parameter">attribs</code></em></span>
         <dd>

          <span class="simpara">
           The third parameter, <em><code class="parameter">attribs</code></em>, 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.html" 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 <em><code class="parameter">attribs</code></em> the normal way, using
            <span class="function"><a href="function.each.html" class="function">each()</a></span>.The first key in the array was the first
           attribute, and so on.
          </span>
         </dd>

        </dt>

       </dl>

      </p>
      <blockquote class="note"><p><strong class="note">Note</strong>: <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>

    <dt>

     <span class="term"><em><code class="parameter">end_element_handler</code></em></span>
     <dd>

      <p class="para">
       The function named by <em><code class="parameter">end_element_handler</code></em>
       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> <code class="parameter">$parser</code></span>
        , <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>
        )</div>

       <dl>

        <dt>

         <span class="term"><em><code class="parameter">parser</code></em></span> 
         <dd>

          <span class="simpara">
           The first parameter, <span class="replaceable">parser</span>, is a
           reference to the XML parser calling the handler.
          </span>
         </dd>

        </dt>

        <dt>

         <span class="term"><em><code class="parameter">name</code></em></span>
         <dd>

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

        </dt>

       </dl>

      </p>
      <p class="para">
       If a handler function is set to an empty string, or <strong><code>FALSE</code></strong>, the handler
       in question is disabled.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.xml-set-element-handler-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.xml-set-default-handler.html">xml_set_default_handler</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.xml-set-end-namespace-decl-handler.html">xml_set_end_namespace_decl_handler</a></div>
 <div class="up"><a href="ref.xml.html">XML Parser Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>