473,395 Members | 1,556 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,395 software developers and data experts.

Calling member functions from expat parser


Can I declare a class that will handle retrieving and parsing XML using
Expat? What I mean is, can an object member function be used as the
callback function for xml parsing?

If so, can someone give me an example line to register the callback.

(I can only use PHP4 on this server, political reasons)

Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

Mar 27 '06 #1
2 1316
http://us2.php.net/manual/en/languag...types.callback

In php, callbacks take the following forms:
- A string, ie: function foo(); do_callback('foo');
- A two element array with the object/class and the function, ie:
array($objInstance, 'method'), or array('ClassName', 'method')

The method must be public (for obvious reasons).

So, yes, should be possible.

Mar 27 '06 #2
On Mon, 27 Mar 2006 08:18:28 -0800, Richard Levasseur wrote:
http://us2.php.net/manual/en/languag...types.callback

In php, callbacks take the following forms: - A string, ie: function
foo(); do_callback('foo'); - A two element array with the object/class
and the function, ie: array($objInstance, 'method'), or array('ClassName',
'method')

The method must be public (for obvious reasons).

So, yes, should be possible.


Thanks mate, that's brilliant (and it'll have to be public, limited to
PHP4 as per my prev post).

Cheers,
Andy

--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

Mar 27 '06 #3

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

Similar topics

1
by: Will Stuyvesant | last post by:
There seems to be no XML parser that can do validation in the Python Standard Libraries. And I am stuck with Python 2.1.1. until my web master upgrades (I use Python for CGI). I know pyXML has...
1
by: Doug | last post by:
I am running solaris 7 on two machines. I compiled python 2.2.1 with expat parser on one machine. The python binary is located in /usr/local/bin and the libraries are located in /usr/local/lib. ...
0
by: Fabian Kr?ger | last post by:
Hello, I got a weird problem and need your help and ideas... I´ve written an php application which imports data in XML format and writes this data to a MySQL database to have a faster access....
4
by: Jakob Møbjerg Nielsen | last post by:
Expat keeps telling me that there is "junk after document element". I've tried different encoding, and I'm quite sure that the buffer is nul-terminated. I really have no idea to what the problem...
4
by: Sridhar | last post by:
HI All, Currently writing a small program and here is my xml file and program. --------------------------------------------------------------------------------- <?xml version="1.0"...
2
by: Steve Juranich | last post by:
I'm running into problems where Python and VTK both ship with their own distribution of the Expat parser. As long as you never use the Python XML package, everything is fine. But if you try using...
4
by: Maarten Verhage | last post by:
Hi All, I've made a modified version of the Expat elements.c example. What I want the program to do is to recognize a hardcoded element-name/tag-name and then execute some code which has access...
1
by: vadlapatlahari | last post by:
Hi, I get the following error with Expat while configuring my application server. Can anyone suggest a solution? When i do an ldd, i get the following : $ldd Expat.so Expat.so needs:...
0
by: kjs1028x | last post by:
Hi! I am using Expat to parse XML files. I have implemented start/end/data handlers for my parser. My parser is able to parse XML files, but it does not return after it has completed parsing. When...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.