You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Boris Garbuzov <bo...@borealissoft.com> on 2001/05/13 22:29:08 UTC
import does not help
I had DOMException: DOM005 Wrong document on appendChild. I discovered
that both nodes have
different owner document instances. Import method should have helped,
but it does not. Append fails with
same exception. What do I do wrong?
/*
// otherwise fails:
org.w3c.dom.DOMException: DOM005 Wrong document
at
org.apache.xerces.dom.ParentNode.internalInsertBefore(ParentNode.java:390,
Compiled Code)
at
org.apache.xerces.dom.ParentNode.insertBefore(ParentNode.java:322)
at org.apache.xerces.dom.NodeImpl.appendChild(NodeImpl.java,
Compiled Code)
at wasp.Waybill.appendElement(Waybill.java:326)
at wasp.Waybill.toElement(Waybill.java:248)
at wasp.CassDaily.toElements(CassDaily.java:205, Compiled Code)
at wasp.XmlCassFile.append(XmlCassFile.java:225, Compiled Code)
*/
Document currentOwnerDocument =
this.waybillElement.getOwnerDocument();
boolean isDeep = true;
currentOwnerDocument.importNode (element, isDeep);
// fails anyways with same exception
this.waybillElement.appendChild (element);
Re: import does not help
Posted by Boris Garbuzov <bo...@borealissoft.com>.
Thanks a lot!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
------------------------
Paul Brown wrote:
> > currentOwnerDocument.importNode (element, isDeep);
> > // fails anyways with same exception
> > this.waybillElement.appendChild (element);
>
> Take a quick tour of the Javadoc; importNode returns a copy of the imported
> Node, so what you really want is
>
> this.waybillElement.appendChild(currentOwnerDocument.importNode(element,isDe
> ep));
>
> - PB
RE: import does not help
Posted by Paul Brown <pr...@fivesight.com>.
> currentOwnerDocument.importNode (element, isDeep);
> // fails anyways with same exception
> this.waybillElement.appendChild (element);
Take a quick tour of the Javadoc; importNode returns a copy of the imported
Node, so what you really want is
this.waybillElement.appendChild(currentOwnerDocument.importNode(element,isDe
ep));
- PB