----- Original Message -----
From: "Evan Borysko" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, November 12, 2002 2:09 PM
Subject: Re: Problem with adding DOM node from getContentAsDOM() to other
DOM


> I modified the code this :
>
> XMLResource res = (XMLResource)results.nextResource();
> newNode = newDoc.importNode(((Document)
>   res.getContentAsDOM()).getDocumentElement(), true);
> root.appendChild(newNode);
>
> Yet a I still get a org.w3c.dom.DOMException: DOM003
> Namespace error. I had to cast res.getContentAsDOM()
> to a Document to use the getDocumentElement method.
> Was this correct?

You said you got a DocumentImpl, but getContentAsDOM returns Node, so yes,
you have to cast.

I don't know where the namespace exception is coming from.  I believe that
importNode should correctly deal with all the namespace issues, but am not
positive (the documentation is not quite explicit, but it does say that a
Document node cannot be imported, as I guessed in the previous note).

Jeff

Reply via email to