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, 11 Apr 2008

view this page in

xml_set_default_handler

(PHP 4, PHP 5)

xml_set_default_handler — Valorizza il gestore di default

Descrizione

bool xml_set_default_handler ( resource $parser , callback $gestore )

Questa funzione valorizza il gestore di default per parser . Il parametro gestore è una stringa contenente il nome di una funzione che deve esistere quando viene eseguito xml_parse() per il parser XML.

La funzione indicata da gestore deve accettare due parametri:

gestore ( resource $parser , string $dati )
parser
Il primo parametro, parser, è un riferimento al parser XML chiamante il gestore.
dati
Il secondo parametro, dati , contiene i dati. Questi possono essere dichiarazioni XML, dichiarazioni di tipo documento, entità oppure altri dati per i quali non è definito il gestore.

Se il nome della funzione del gestore viene valorizzato con una stringa vuota oppure a FALSE, il gestore in questione viene disabilitato.

La funzione restituisce TRUE se il gestore viene attivato, FALSE se parser non indica un parser XML.

Nota: Invece di un nome di funzione, può essere passato anche un array contenente un riferimento ad oggetto e un nome di metodo.



add a note add a note User Contributed Notes
xml_set_default_handler
anoril at anoril dot com
13-Jul-2006 07: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 02: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, 11 Apr 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites