data argument in XML node listeners
Is the void* data argument in XML node listeners available to pass extra data to listener callback routines, or does it have another function that would prevent that purpose? (For example, passing a pointer to an instance of a class that is unique on a per-document basis.)
I've been reading the listener and DOM tree implementation and it seems that this is correct, but I just wanted to make sure.
-- David
Quoting David Yip <yipdw@...635...>:
Is the void* data argument in XML node listeners available to pass extra data to listener callback routines, or does it have another function that would prevent that purpose? (For example, passing a pointer to an instance of a class that is unique on a per-document basis.)
Yes, you can do that, but I would strongly recommend using XML::Node::addObserver rather than XML::Node::addListener in new code.
XML::Node::addListener is effectively just a wrapper around XML::Node::addObserver, and will be going away after the 0.42 release.
Simply subclass XML::NodeObserver and override the notify*() methods for any events you are interested in. You can keep any needed supplemental data in data memebrs of your subclass.
-mental
Oh, cool -- that will make things much easier. Thanks!
-- David
On Friday 08 July 2005 01:23 pm, mental@...3... wrote:
Yes, you can do that, but I would strongly recommend using XML::Node::addObserver rather than XML::Node::addListener in new code.
XML::Node::addListener is effectively just a wrapper around XML::Node::addObserver, and will be going away after the 0.42 release.
Simply subclass XML::NodeObserver and override the notify*() methods for any events you are interested in. You can keep any needed supplemental data in data memebrs of your subclass.
-mental
participants (2)
-
unknown@example.com
-
David Yip