Namespace Handler isn't being called

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

Threaded View
I'm using the XML functions in PHP 5.  The callback function I set for
namespace declarations doesn't get called.  Can anyone help me out?
The code is:

$xml = '<addressbook
xmlns:ab=" /">' .
$parser = xml_parser_create_ns();

xml_set_element_handler( $parser, 'StartHandler', 'EndHandler' );

/* The handler doesn't get called for some reason */
xml_set_start_namespace_decl_handler( $parser, 'NSHandler' );

xml_parse( $parser, $xml, true);
xml_parser_free( $parser );

function StartHandler( $parser, $name, $attrs ) {
   print( 'StartHandler Called<br/>' );

function EndHandler( $parser, $name ) {
   print( 'EndHandler Called<br/>' );

function NSHandler( $parser, $prefix, $uri ) {
   print( 'NSHandler Called<br/>' );

And the output is:

StartHandler Called
EndHandler Called

I want the output to be

StartHandler Called
EndHandler Called
NSHandler Called


Re: Namespace Handler isn't being called

beveled edges wrote:
Quoted text here. Click to load it

I think this is a bug which is caused by the portation of PHP 4 XML
functions to PHP 5.

On I have found a simular bug related to the
xml_set_default_handler function.

I took the liberty of using your code snippet to create a bug report for
this problem, see:


Site Timeline