<HTML ><HEAD ><TITLE >xml_parse</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="XML parser functions" HREF="ref.xml.html"><LINK REL="PREVIOUS" TITLE="xml_parse_into_struct" HREF="function.xml-parse-into-struct.html"><LINK REL="NEXT" TITLE="xml_parser_create_ns" HREF="function.xml-parser-create-ns.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.xml-parse-into-struct.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.xml-parser-create-ns.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.xml-parse" ></A >xml_parse</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN95954" ></A ><P > (PHP 3>= 3.0.6, PHP 4 )</P >xml_parse -- start parsing an XML document</DIV ><DIV CLASS="refsect1" ><A NAME="AEN95957" ></A ><H2 >Description</H2 >bool <B CLASS="methodname" >xml_parse</B > ( resource parser, string data [, bool is_final])<BR ></BR ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><TT CLASS="parameter" ><I >parser</I ></TT ></DT ><DD ><P > A reference to the XML parser to use. </P ></DD ><DT ><TT CLASS="parameter" ><I >data</I ></TT ></DT ><DD ><P > Chunk of data to parse. A document may be parsed piece-wise by calling <B CLASS="function" >xml_parse()</B > several times with new data, as long as the <TT CLASS="parameter" ><I >is_final</I ></TT > parameter is set and <TT CLASS="constant" ><B >TRUE</B ></TT > when the last data is parsed. </P ></DD ><DT ><TT CLASS="parameter" ><I >is_final</I ></TT > (optional)</DT ><DD ><P > If set and <TT CLASS="constant" ><B >TRUE</B ></TT >, <TT CLASS="parameter" ><I >data</I ></TT > is the last piece of data sent in this parse. </P ></DD ></DL ></DIV > </P ><P > When the XML document is parsed, the handlers for the configured events are called as many times as necessary, after which this function returns <TT CLASS="constant" ><B >TRUE</B ></TT > or <TT CLASS="constant" ><B >FALSE</B ></TT >. </P ><P > <TT CLASS="constant" ><B >TRUE</B ></TT > is returned if the parse was successful, <TT CLASS="constant" ><B >FALSE</B ></TT > if it was not successful, or if <TT CLASS="parameter" ><I >parser</I ></TT > does not refer to a valid parser. For unsuccessful parses, error information can be retrieved with <A HREF="function.xml-get-error-code.html" ><B CLASS="function" >xml_get_error_code()</B ></A >, <A HREF="function.xml-error-string.html" ><B CLASS="function" >xml_error_string()</B ></A >, <A HREF="function.xml-get-current-line-number.html" ><B CLASS="function" >xml_get_current_line_number()</B ></A >, <A HREF="function.xml-get-current-column-number.html" ><B CLASS="function" >xml_get_current_column_number()</B ></A > and <A HREF="function.xml-get-current-byte-index.html" ><B CLASS="function" >xml_get_current_byte_index()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.xml-parse-into-struct.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.xml-parser-create-ns.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >xml_parse_into_struct</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.xml.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >xml_parser_create_ns</TD ></TR ></TABLE ></DIV ></BODY ></HTML >