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

search for in the

xml_set_element_handler> <xml_set_character_data_handler
Last updated: Fri, 18 Jul 2008

view this page in

xml_set_default_handler

(PHP 4, PHP 5)

xml_set_default_handler — set up default handler

Descripción

int xml_set_default_handler ( int $parser , string $handler )

Establece la función gestora por defecto para un analizador XML parser . handler es un string que contiene el nombre de la función que debe existir cuando xml_parse() es llamado por parser .

La función nombrada en handler debe aceptar dos parámetros:

handler ( int $parser , string $data )
parser
El primer parámetro, parser, es una referencia al analizador XML que llama al gestor.
data
El segundo parámetro, data , contiene los caracteres de dato. Esto puede ser la declaración XML, la declaración de tipo de documento, entidades u otros datos para los cuales no existe otro gestor.

Si una función gestora se establece como la cadena vacía, o FALSE, el gestor en cuestión se deshabilita.

Se devuelve TRUE si se estableció el gestor, FALSE si parser no es un analizador.

En la actualidad no hay soporte para gestores objeto/método.



add a note add a note User Contributed Notes
xml_set_default_handler
anoril at anoril dot com
13-Jul-2006 11:54
I have the same issue using two installation of PHP5: on accepts to use the default handler while the other only uses the character_data one.

Maybe a configuration problem...

;) Nonor.
phillip
26-Apr-2005 06:13
it seems to me that in PHP5 the function defined as default-handler (using xml_set_default_handler()) doesen't get passed the cdata anymore:

i.e.:
xml_set_element_handler($this->parser, 'parseSTART', 'parseEND');
xml_set_default_handler($this->parser, 'parseDEFAULT');
function parseSTART() { ... }
function parseEND() { ... }
function parseDEFAULT() { ... }

under PHP5, parseDEFAULT will NOT get passed any cdata, but unter PHP4 it will. at least that's my take on the strange stuff (not) happening after migrating to PHP5.

my solution was to add a xml_set_character_data_handler($parser, 'parseDEFAULT'). it worked for me.

xml_set_element_handler> <xml_set_character_data_handler
Last updated: Fri, 18 Jul 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites