This week's book giveaway is in the OCAJP forum. We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line! See this thread for details.
I ran into a strange issue. When I used adoptNode() to adopt a node from a different document to another one, it did import the node, but misplaced some data(and inserted some nulls) in the destination document.
The misplaced data was making the destination document to fail when validated with the DTD.
I have fixed the issue by changing the adoptNode() method to importNode().
Below is a sample incorrect XML generated using adoptNode(). See there is a null some how got inserted.
Now my observation is that, when I just print the child nodes of the node I am adopting, the issue gets resolved and adoptNode() works fine.
The commented one line importNode() code is the one I actually have. When I comment that, and by using the code from for loop till adoptNode() the issue does not occur.
This is not actually a question... just wanted to share the behavior I noticed...