XML technologies / XML / XML in a Nutshell / DOM reference / Object reference / UserDataHandler

(Excerpt from "XML in a Nutshell" by Elliotte Rusty Harold & W. Scott Means)

The method Node.setUserData( ) allows the programmer to register a callback object notified when various operations are performed on the node in question. These callback objects must implement this interface to receive the notifications.

 

Attributes

The interface UserDataHandler has no attributes.

 

Method

The following method is defined for this interface:

 

handle: operation, key, data, src, dst (3)

This method is called when the Node object associated with the parent object derived from UserDataHandler is imported or cloned. This method must be implemented by users of DOM who want notification when monitored Node objects are manipulated.

Note: When implementing the handle( ) method, make sure to catch any exceptions so that they do not propagate into the calling DOM code. Internal DOM behavior is undefined if this method throws an exception.

Arguments

  • operation: unsigned short

    The kind of operation that occurred. It is based on the following values:

Konstantenname

Wert

Bedeutung

NODE_CLONED

1

Der überwachte Knoten wurde mit Node.cloneNode( ) geklont.

NODE_IMPORTED

2

Der überwachte Knoten wurde mit Document.importNode( ) importiert.

NODE_DELETED

3

Der Knoten wurde gelöscht. In Umgebungen (wie Java), die keinen expliziten Lösch-Operator haben, ist das nicht unbedingt zuverlässig.

NODE_RENAMED

4

Der Knoten wurde mit Document.renameNode( ) umbenannt.

NODE_ADOPTED

5

Der überwachte Knoten wurde im Document.adoptNode( ) adoptiert.

  • key: DOMString

    The user-defined key from the Node.setUserData( ) method for which the handle( ) method is called.

  • data: DOMUserData

    The user data corresponding to the key argument and originally set using the method Node.setUserData( ).

  • src: Node

    The node being cloned, adopted, imported or renamed. This argument is null, when the node is deleted.

  • dst: Node

    The newly cloned or imported node, or null, if no new node was created.

Java binding
public boolean isDerivedFrom(String typeNamespaceArg, String typeNameArg, int derivationMethod);

  

 

 

 

back to top