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 Wendi Sisson <ws...@east.fedex.com> on 2001/12/30 21:45:32 UTC

ClassCastException with Document's adoptNode method

I cannot figure out why I get a class cast exception when trying to use
the experimental adoptNode method in the Document interface. The
signature of the method is Node adoptNode(Node source). I'm using Xerces
1.4.3.

I am trying to adopt the root element of one document into another
document. The following is the code I am attempting:

		// Document doc, doc2 
                Element doc2root = doc2.getDocumentElement();

		// class cast exception at this line
                Node adoptedRoot = doc.adoptNode(doc2root);

		/* I also tried this instead
		but I still get the same exception */
 		// Node adoptedRoot = doc1.adoptNode((Node)doc2Root);
	
                element.appendChild(adoptedRoot);

Thanks for any help or insight you may be able to provide. Wendi
-- 
Wendi Sisson
Systems Programmer
International Trade Development
FedEx Services
(901) 263-6695

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