[Home] [By Thread] [By Date] [Recent Entries]

  • To: xml-dev@l...
  • Subject: importNode returns null
  • From: Vidar Ramdal <vramdal@g...>
  • Date: Tue, 24 May 2005 17:42:15 +0200
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=NTQoq4kQVJAcC/qKyOsPtXLg5c5TWrG9R8CaMNWvui6eXjpXmGtXyHalULLDyaa9co6euqaj0/9SiE0RUWlgPS3DWDerBoAD5Xr7cFLQTYdD3GUvmwG6zLalSDFoOUv6tAkfVxb7aYR/wGxmCXaYINeNmTWk3x7i1udpHLTh78U=
  • Reply-to: Vidar Ramdal <vramdal@g...>

In my Java application, I'm trying replace a node with a node from
another document. I have a reference to the node I wish to replace
(originalNode), and the new node (newNode).

Node importedNode = originalNode.getOwnerDocument().importNode(newNode, true);
originalNode.getParentNode().replaceChild(importedNode, originalNode);

However, I couldn't get replaceChild to work, and started
investigating. I found that importedNode is always null - that is,
importNode always returns null.

Does anyone see how this can happen? There are no exceptions thrown.

-- 
Vidar S. Ramdal <vramdal@g...>
"In the beginning, the universe was created. This made a lot of people
very angry, and has been widely regarded as a bad idea."  --  Douglas
Adams

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member