You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Suk Tae Kyung <tk...@penta.co.kr> on 2000/09/29 03:30:20 UTC
About setOwnerDocument
Hi, Xerces developers. I need ChildAndParentNode class's setOwnerDocument() method.
Because of dynamic DOM manipulation.( for example, "replaceChild" or "appendChild". While
trying this, i get message "DOM005 Wrong document".)
But setOwnerDocument() is not yet public method. Is there any reason to conceal this method?
Thank you for reading this message. Thanks in advance.
Re: About setOwnerDocument
Posted by Arnaud Le Hors <le...@us.ibm.com>.
> Suk Tae Kyung wrote:
>
> Hi, Xerces developers. I need ChildAndParentNode class's
> setOwnerDocument() method.
>
> Because of dynamic DOM manipulation.( for example, "replaceChild" or
> "appendChild". While
>
> trying this, i get message "DOM005 Wrong document".)
>
> But setOwnerDocument() is not yet public method. Is there any reason
> to conceal this method?
>
> Thank you for reading this message. Thanks in advance.
The method you're referring to here is part of the internal of Xerces.
You can use it as your own risk but there is no plan to support it as a
public API any time (nor is the ChildAndParentNode class for that
matter...)
Because the DOM is only an API and it is designed to work on top of very
different types of implementations it is impossible to assume that a
node can always be moved from one document to another. So the DOM
disallows this.
Instead you can use Document.importNode(), which clones a node from
document to another.
In addition, I've implemented a method on DocumentImpl, called
adoptNode(), which can be used to *tentatively move* a node from one
document to another. This extension has been submitted for
standardization to W3C and is likely to be part of DOM Level 3.
Depending on the context it may however fail. Applications should be
prepared for that. (It should always work within Xerces though)
--
Arnaud Le Hors - IBM Cupertino, XML Technology Group