You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by "Liu, Richard" <Ri...@boeing.com> on 2004/12/08 02:45:58 UTC

DOMNode AppendChild () function question

Hi,
 
   I have a XalanNode, I need to append new node to it.
 
   After I call the function "mapNode", I change it to a DOMNode, then I call the function appendNode ().
 
   However, I got an "XERCES_CPP_NAMESPACE::DOMException error".    
 
  When I read the description of DOMException error for function appendNode (), I found my error may come from the following description:
 
   WRONG_DOCUMENT_ERR: Raised if newChild was created from a different document than the one that created this node.
 
My new child comes from a different document, how can I append the new child to this document ?
 
If there are some code example, that will be very helpful.
 
 
Thanks
 
Richard Liu
Softtware Engineer at Boeing
 
 
   
 

Re: DOMNode AppendChild () function question

Posted by da...@us.ibm.com.
Hi,

You need to use importNode() and then use appendNode().

Any good book or tutorial on the DOM will explain the details.  This is 
really out of the scope of Xalan-C, so you will not find any information 
in our documentation and samples.

Dave





"Liu, Richard" <Ri...@boeing.com>
12/07/2004 05:45 PM
Please respond to xalan-c-users
 
        To:     <xa...@xml.apache.org>
        cc:     "Liu, Richard" <Ri...@boeing.com>, (bcc: David N 
Bertoni/Cambridge/IBM)
        Subject:        DOMNode AppendChild () function question

Hi,
 
   I have a XalanNode, I need to append new node to it.
 
   After I call the function "mapNode", I change it to a DOMNode, then I 
call the function appendNode ().
 
   However, I got an "XERCES_CPP_NAMESPACE::DOMException error". 
 
  When I read the description of DOMException error for function 
appendNode (), I found my error may come from the following description:
 
   WRONG_DOCUMENT_ERR: Raised if newChild was created from a different 
document than the one that created this node.
 
My new child comes from a different document, how can I append the new 
child to this document ?
 
If there are some code example, that will be very helpful.
 
 
Thanks
 
Richard Liu
Softtware Engineer at Boeing