[Zope-dev] XML Document appendChild questions
Martijn Faassen
M.Faassen@vet.uu.nl
Tue, 27 Jul 1999 20:35:27 +0200
Paul Prescod wrote:
>
> Martijn Faassen wrote:
> >
> > def appendChild(self, newChild):
> > """
> > Adds the node newChild to the end of the list of children of
> > this node.
> > If the newChild is already in the tree, it is first removed.
> > """
> >
> > But in this case 'newChild' is in *another* tree and it is removed as
> > well. Is this intentionally?
>
> I don't think that the standard DOM API even has a provision for moving
> nodes from one document to another.
This is possible, thought the provision (in the DOM spec):
Adds the node newChild to the end of the list of children of this node.
If the newChild is already in the tree, it is first removed.
would imply that it is possible for a newChild to be added that is not
already in the tree. But apparently it can't come from another tree, as
that is cloning it, really?
> The more important point is that a single element cannot have two parents.
> You should clone it.
Yeah, but that isn't supported by XML Document yet. :) Perhaps the newer
version is, and if it isn't, I'll look at trying to add it (first I want
to see the new version has it, but then I need to be able to get my
hands on it).
Regards,
Martijn