XML handler parameters

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Some of the parametesr to the xml_set_*_handler are supposed to be the
names of "handler" functions that accept certain parameters.  For
example, xml_set_character_data_handler's handler function is supposed
to take two parameters - parser and data.

My question is...  what purpose does passing the parser object to the
handler function serve?  None of the handler functions I've seen make
any use of it and not all callback functions (as I guess a handler
function is) require the object that it is supposed to be working on be
passed to it (array_map, for example)...

Re: XML handler parameters

Quoted text here. Click to load it

 Probably so in theory you can have multiple parse operations running all using
the same callback functions, but routing data into different places using the
parser object to differentiate between instances?

 Although it's probably neater to just use an object method callback to do this
instead of a global function callback, and I'd guess having multiple parse
operations on the go at the same time in a PHP script is rare enough anyway.

Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

Site Timeline