George:

Document doc;     // the document you want to use
Element elem;     // the Node you want to change

Node node = doc.importNode(elem, true);   //import elem and all its
subnodes;

In the code above, 'elem' is being copied into 'doc' and a reference to
that copy is stored in 'node'.  It is only in doc's context -- it's not
actually part of the XML document yet (i.e., a serializer won't put tags
out for it) until you append it to some part of the XML tree that doc
contains.  elem is still part of the old document -- there's no way, in
DOM, to change a node's document or delete a node once you've created one.
The Document object that created the node will always be its parent.

I tend to not use proprietary interfaces, since it makes the code less
portable, but it could be that Xerces has an interface that will let you
manipulate nodes this way.  Anybody?

C




                                                                                
                                                       
                                                                                
                                                       
                                               To:       <[EMAIL PROTECTED]>    
                                            
                      "George                  cc:       (bcc: Constantine 
Georges/Towers Perrin)                                      
                      Papamarkos"              Subject:  Setting Owner Document 
                                                       
                      <[EMAIL PROTECTED]                                        
                                                        
                      .bbk.ac.uk>                                               
                                                       
                                                                                
                                                       
                      06/10/2003 01:58                                          
                                                       
                      PM                                                        
                                                       
                      Please respond to                                         
                                                       
                      xerces-j-user                                             
                                                       
                                                                                
                                                       
                                                                                
                                                       




Hi all,
        I am trying to find a way to set the owner document of a node to
the
one I want. Is there any proprietary way to do so?
I would appriciate any help.

Regards,

George


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to