473,406 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Namespace Handler isn't being 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
1 1777
beveled edges wrote:
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?


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

On bugs.php.net 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:

http://bugs.php.net/bug.php?id=30061
JW

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: beveled edges | last post by:
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...
25
by: kj | last post by:
Consider the following XML document: <?xml version='1.0' encoding='UTF-8'?> <bar:foo xmlns:bar='someuri'> <baz/> </bar:foo> What namespace does baz belong to? What is this namespace bound...
6
by: demo | last post by:
using visual studio 6 with service pack 0 and 5, why does the distructor of a class contained inside a namespace isn't called and instead it's called when: - iostream.h is included instead of...
7
by: Joakim Braun | last post by:
Why doesn't the below code work? I'm trying to create a global object and set an event handler to one of its methods. The function is called, but the object's mTest property is undefined. ...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
2
by: Martin Lapierre | last post by:
How can I remove the default exception handler handler? When adding a custom handler, I can't get rid of the VS.NET unhandled exception dialog. Ex: AppDomain currentDomain =...
3
by: jeff29_b | last post by:
I am having a strange problem on a web form. I have an image button with an OnClick event handler. When I click the image the event isn't being called in the code behind when browsing in firefox....
1
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST> xml file 2
12
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST>
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.