You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by ji...@apache.org on 2004/04/19 23:00:53 UTC

[jira] Updated: (XERCESJ-947) Documnet.adoptNode() does not call user data handler

The following issue has been updated:

    Updater: nddelima (mailto:nddelima@ca.ibm.com)
       Date: Mon, 19 Apr 2004 2:00 PM
    Comment:
Proposed patch
    Changes:
             Attachment changed to CoreDocumentImpl.java.patch
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/XERCESJ-947?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XERCESJ-947

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XERCESJ-947
    Summary: Documnet.adoptNode() does not call user data handler
       Type: Bug

     Status: Open
   Priority: Minor

    Project: Xerces2-J
 Components: 
             DOM
   Versions:
             2.6.2

   Assignee: Venugopal Rao K
   Reporter: Venugopal Rao K

    Created: Mon, 19 Apr 2004 12:11 AM
    Updated: Mon, 19 Apr 2004 2:00 PM

Description:
To reproduce the bug compile and run test.java as shown in the log below:
------------------------------------------ test.java
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
import org.w3c.dom.UserDataHandler;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
class test {
    static boolean called;
    public static void main(String [] args) throws Exception {
        UserDataHandler handler = new UserDataHandler() {
            public void handle(short operation, String key, 
                               Object data, Node src, Node dst) {
                if (key != null 
                 && operation == UserDataHandler.NODE_ADOPTED) {
                    called = true;
                }
            }
        };
        DocumentBuilder docBuilder 
            = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document firstDoc = docBuilder.newDocument();
        Document secondDoc = docBuilder.newDocument();
        Element adoptedElem = secondDoc.createElement("root");
        adoptedElem.setUserData("comment"
            , "user data of the element", handler);
        firstDoc.adoptNode(adoptedElem);
        if (null != firstDoc.adoptNode(adoptedElem) && !called) {
            System.out.println("the user data handler has not been called");
        } else {
            System.out.println("OK");
        }
    }
}


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org