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-parse.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-parse.php',
   
1 => 'xml_parse',
  ),
 
'up' =>
  array (
   
0 => 'ref.xml.php',
   
1 => 'XML Parser Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.xml-parse-into-struct.php',
   
1 => 'xml_parse_into_struct',
  ),
 
'next' =>
  array (
   
0 => 'function.xml-parser-create-ns.php',
   
1 => 'xml_parser_create_ns',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.xml-parse" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">xml_parse</h1>
  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">xml_parse</span> &mdash; <span class="dc-title">Start parsing an XML document</span></p>

 </div>

 <a name="function.xml-parse.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><b>xml_parse</b></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">$data</tt></span>
   [, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$is_final</tt><span class="initializer"> = false</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   <b>xml_parse()</b> parses an XML document. The handlers for
   the configured events are called as many times as necessary.
  </p>
 </div>


 <a name="function.xml-parse.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">
       A reference to the XML parser to use.
      </p>
     </dd>

   
    <dt class="varlistentry">

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

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

      <p class="para">
       Chunk of data to parse.  A document may be parsed piece-wise by
       calling <b>xml_parse()</b> several times with new data,
       as long as the <i><tt class="parameter">is_final</tt></i>
 parameter is set and
       <b><tt class="constant">TRUE</tt></b> when the last data is parsed.
      </p>
     </dd>

   
    <dt class="varlistentry">

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

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

      <p class="para">
       If set and <b><tt class="constant">TRUE</tt></b>, <i><tt class="parameter">data</tt></i>
 is the last piece of
       data sent in this parse.
      </p>
     </dd>

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


 <a name="function.xml-parse.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns 1 on success or 0 on failure.
  </p>
  <p class="para">
   For unsuccessful parses, error information can be retrieved with
   <a href="function.xml-get-error-code.php" class="function">xml_get_error_code()</a>,
   <a href="function.xml-error-string.php" class="function">xml_error_string()</a>,
   <a href="function.xml-get-current-line-number.php" class="function">xml_get_current_line_number()</a>,
   <a href="function.xml-get-current-column-number.php" class="function">xml_get_current_column_number()</a> and
   <a href="function.xml-get-current-byte-index.php" class="function">xml_get_current_byte_index()</a>.
  </p>
  <blockquote><p><b class="note">Note</b>:
  
    Entity errors are reported at the end of the data thus only if
    <i><tt class="parameter">is_final</tt></i>
 is set and <b><tt class="constant">TRUE</tt></b>.
   <br />
  </p></blockquote>
 </div>


</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites