You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Joel Roth-Nater <jr...@quoininc.com> on 2000/10/17 23:32:29 UTC
trouble importing nodes into doc
hi there,
i'm trying to merge two documents by doing the following
1: doc1 = parse( ... )
2: doc2 = parse( ... ) // re-using parser object
3:
4: node1 = doc1.find( ... )
5: node2 = doc2.find( ... )
6:
7: newNode1 = doc1.import( node2, true )
8: node1.getParentNode().replaceChild( node1, newNode1 )
the import at 7: throws a DOM_DOMException with code 8
( NOT_FOUND_ERR ) and no message, and i never get to 8:
i've checked that both documents are healthy and the find
operations in 4: and 5: return valid nodes.
what am i missing?
any insight is greatly appreciated.
thanks -- joel
Re: trouble importing nodes into doc
Posted by Tony Wuebben <wu...@lexis-nexis.com>.
Joel:
The correct syntax for replaceChild() is
replaceChild(newChild,oldChild);
therefore your statement should be
node1.getParentNode().replaceChild(newNode1,node1);
Hopefully this is your problem, I'm doing what your doing below without
any errors.
Tony
Joel Roth-Nater wrote:
>
> hi there,
>
> i'm trying to merge two documents by doing the following
>
> 1: doc1 = parse( ... )
> 2: doc2 = parse( ... ) // re-using parser object
> 3:
> 4: node1 = doc1.find( ... )
> 5: node2 = doc2.find( ... )
> 6:
> 7: newNode1 = doc1.import( node2, true )
> 8: node1.getParentNode().replaceChild( node1, newNode1 )
>
> the import at 7: throws a DOM_DOMException with code 8
> ( NOT_FOUND_ERR ) and no message, and i never get to 8:
>
> i've checked that both documents are healthy and the find
> operations in 4: and 5: return valid nodes.
> what am i missing?
>
> any insight is greatly appreciated.
>
> thanks -- joel
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org