Skip to content
Advertisement

importNode throws org.w3c.dom.DOMException: NOT_SUPPORTED_ERR

I am trying to merge two XML documents both with standard Oracle JDK 7 and also with Saxon HE but I keep getting an:

JavaScript

On the line with the importNode below (same thing happens with adoptNode BTW):

JavaScript

I’ve tried both with Saxon-HE-9.4.jar on my classpath or not, but I still get the same error.

update

Based on comments I received, when I try with:

JavaScript

I get instead:

JavaScript

After googling I see old messages to the effect that Saxon apparently creates a read-only DOM which is weird since I thought that one of the comparison points of DOM vs SAX is that DOM is read-write whereas SAX is read-only.

Advertisement

Answer

To merge two documents (I’m not sure exactly what you mean by this, but I’ll guess) using Saxon, you don’t want to be fiddling about with a DOM. Just run this XQuery:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement