<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >xml_set_element_handler</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="XML Parser Functions" HREF="ref.xml.html"><LINK REL="PREVIOUS" TITLE="xml_set_default_handler" HREF="function.xml-set-default-handler.html"><LINK REL="NEXT" TITLE="xml_set_end_namespace_decl_handler" HREF="function.xml-set-end-namespace-decl-handler.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></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" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.xml-set-default-handler.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.xml-set-end-namespace-decl-handler.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.xml-set-element-handler" ></A >xml_set_element_handler</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN123087" ></A ><P > (PHP 3>= 3.0.6, PHP 4 , PHP 5)</P >xml_set_element_handler -- Set up start and end element handlers</DIV ><DIV CLASS="refsect1" ><A NAME="AEN123090" ></A ><H2 >Description</H2 >bool <B CLASS="methodname" >xml_set_element_handler</B > ( resource parser, callback start_element_handler, callback end_element_handler)<BR ></BR ><P > Sets the element handler functions for the XML parser <VAR CLASS="parameter" >parser</VAR >. <VAR CLASS="parameter" >start_element_handler</VAR > and <VAR CLASS="parameter" >end_element_handler</VAR > are strings containing the names of functions that must exist when <A HREF="function.xml-parse.html" ><B CLASS="function" >xml_parse()</B ></A > is called for <VAR CLASS="parameter" >parser</VAR >. </P ><P > The function named by <VAR CLASS="parameter" >start_element_handler</VAR > must accept three parameters: <B CLASS="methodname" ><VAR CLASS="replaceable" >start_element_handler</VAR ></B > ( resource parser, string name, array attribs)<BR ></BR > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><VAR CLASS="parameter" >parser</VAR ></DT ><DD ><P > The first parameter, <VAR CLASS="replaceable" >parser</VAR >, is a reference to the XML parser calling the handler. </P ></DD ><DT ><VAR CLASS="parameter" >name</VAR ></DT ><DD ><P > The second parameter, <VAR CLASS="parameter" >name</VAR >, contains the name of the element for which this handler is called. If <A HREF="ref.xml.html#xml.case-folding" >case-folding</A > is in effect for this parser, the element name will be in uppercase letters. </P ></DD ><DT ><VAR CLASS="parameter" >attribs</VAR ></DT ><DD ><P > The third parameter, <VAR CLASS="parameter" >attribs</VAR >, contains an associative array with the element's attributes (if any). The keys of this array are the attribute names, the values are the attribute values. Attribute names are <A HREF="ref.xml.html#xml.case-folding" >case-folded</A > on the same criteria as element names. Attribute values are <SPAN CLASS="emphasis" ><I CLASS="emphasis" >not</I ></SPAN > case-folded. </P ><P > The original order of the attributes can be retrieved by walking through <VAR CLASS="parameter" >attribs</VAR > the normal way, using <A HREF="function.each.html" ><B CLASS="function" >each()</B ></A >. The first key in the array was the first attribute, and so on. </P ></DD ></DL ></DIV > </P ><P > The function named by <VAR CLASS="parameter" >end_element_handler</VAR > must accept two parameters: <B CLASS="methodname" ><VAR CLASS="replaceable" >end_element_handler</VAR ></B > ( resource parser, string name)<BR ></BR > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><VAR CLASS="parameter" >parser</VAR ></DT ><DD ><P > The first parameter, <VAR CLASS="replaceable" >parser</VAR >, is a reference to the XML parser calling the handler. </P ></DD ><DT ><VAR CLASS="parameter" >name</VAR ></DT ><DD ><P > The second parameter, <VAR CLASS="parameter" >name</VAR >, contains the name of the element for which this handler is called. If <A HREF="ref.xml.html#xml.case-folding" >case-folding</A > is in effect for this parser, the element name will be in uppercase letters. </P ></DD ></DL ></DIV > </P ><P > If a handler function is set to an empty string, or <TT CLASS="constant" ><B >FALSE</B ></TT >, the handler in question is disabled. </P ><P > <TT CLASS="constant" ><B >TRUE</B ></TT > is returned if the handlers are set up, <TT CLASS="constant" ><B >FALSE</B ></TT > if <VAR CLASS="parameter" >parser</VAR > is not a parser. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B >În locul numelui unei funcþii, poate fi folosit un tablou conþinând o referinþã cãtre un obiect sau numele unei metode.</P ></BLOCKQUOTE ></DIV ></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-set-default-handler.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.xml-set-end-namespace-decl-handler.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >xml_set_default_handler</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.xml.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >xml_set_end_namespace_decl_handler</TD ></TR ></TABLE ></DIV ></BODY ></HTML >