470,815 Members | 1,084 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Namespace Handler isn't called

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="http://www.somewhere.com/addressbook/">' .
'</addressbook>';
$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
Cheers,
Aeden
Jul 17 '05 #1
0 1267

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by beveled edges | last post: by
25 posts views Thread by kj | last post: by
7 posts views Thread by Joakim Braun | last post: by
3 posts views Thread by jeff29_b | last post: by
1 post views Thread by Plop69 | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.