RE: [xml] Feature request: callbacks



-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com]
Subject: Re: [xml] Feature request: callbacks


On Thu, Mar 15, 2001 at 11:02:04AM +0100, Alfred Reibenschuh wrote:
hi!

adding callback for tree-changes seams to be a good thing to do,
but then with a more global approach -- having callbacks for
creation, change and deletion of nodes globally per tree
and change and deletion callbacks per node.

  yes, that's what I was thinking. Except I don't perceive the difference
you make w.r.t. per node or per tree. Could you elaborate ?

ahmm ... robert pointed that out in his email ... let me sum it up as i see this: 

having a callback structure at node, document and application-level like:

struct {
        int xmlCallbackStackLevel;
        void * xmlTreeChangeCallbackStack[];
}

whereas the first pointer registered in xmlTreeChangeCallbackStack at node-level
would be the callback-handler for the document-level and the first pointer registered 
at document-level would be the callback-handler for the application-level
and the first pointer registered at application-level would be libxml's own handler
or NULL whichever is preferable

if a node is changed/deleted/.... the callbacks are called in descending order
on the node, the first callback of the node then calls all the document-callbacks
etc, etc ...

  - Callback signature:
    a few week ago I would have used
    void (*xmlTreeChangeCallback) (xmlNodePtr node);
    but it's clear that Perl binding would require something like
    void (*xmlTreeChangeCallback) (void *user_data, xmlNodePtr node);
    is that sufficient ? I assume user_data would be registered at
    the same time as the set of callbacks.

definitely "void (*xmlTreeChangeCallback) (void *user_data, xmlNodePtr node)",
since that seems to me just what perl and php need :) 


( users should then be required to call the change-callback  
  on the completion of a change to a node )

  Hum, that is application dependant ... what I want to define
is the library behaviour and not step on the toes of the application
writer.

just forget it then ...


<shame>
  Euro's one or dollar's ?
</shame>

<pride type="assuring" lang="de_AT">
        it's the &Euro; one :)
</pride>

 

-- Alfred Reibenschuh

(Khelben Blackstaff)

linux  geek, | Sometimes I hear voices in my head ,  telling me to do 
perl monger, | strange things,  but I always wonder  if that's just me
 roleplayer  | thinking about things I really want to do anyway. Why 
& sf-fanatic | do the voices never say, "Your dosage needs adjustment"?
        look @ http://penguin.at0.net/~fredo/





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]