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 ?

Basically if we start adding callbacks from the tree handling module
to user defined functions, then I want to set up a complete framework
rather than adding interfaces one by one.
I would also like to make sure that the API so defined will work for
everybody, the recent difficulties exposed by Matt in this area lead
me to conclude that *I don't know* ... Hence my call for expertise.

Here are the axis for which there is multiple choices:
  - Set of callbacks:
    basically on what operation do we need callbacks to be definable ?
    my current list, based on my recollection of the Thot API is:
    + node creation
    + structure changes
      nodes being moved/unlinked/or relinked into a tree
    + content change
      text node content being changed (in attributes or nodes)
    + node destruction
    remember, attributes and documents are nodes too :-)
  - Registration of callback:
    + considering there is multiple callbacks, should the API
      be at the registration of a single callback or a callback set ?
    + scope of the registration, I'm leaning toward an application wide
      registration, but some may argue that this must be done on a 
      document per document basis (and would require a structure change
      for the document nodes :-( it also makes the lookup more costly
      or even impossible in some obscure cases I would rather avoid this).
  - 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.

  I will let this brew till the end of the week and may spend time
implementing it during the week-end.

( 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.

my 10 cents

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

Daniel

-- 
Daniel Veillard      | Red Hat Network http://redhat.com/products/network/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/




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