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...