You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by "J. Wolfgang Kaltz" <jw...@apache.org> on 2005/04/15 17:37:31 UTC

[trunk] creating document fails (Was Re: svn commit: r161284 - in lenya/trunk/src/java/org/apache/lenya: ./ cms/ant/ cms/cocoon/acting/ cms/cocoon/components/modules/input/ cms/metadata/dublincore/ cms/metadata/usecases/ cms/publication/ cms/publication/task/ cms/site/usecases/)

I'm trying to figure out the error regarding document creation in trunk 
I mentioned earlier today.

In DefaultSiteTree::addNode() the error occurs at 
parentNode.appendChild(), namely
   WRONG_DOCUMENT_ERR: A node is used in a different document than the 
one that created it. (This is a Java DOM Api error)

IIUC in that method,
- "parentNode" is created with "getNodeInternal(parentid)". This 
ultimately calls load() to create a Document instance;
- "document" is a document instance created with "Document document = 
load()"
- "child" is a new node, created from "document" (via the NamespaceHelper)
- the document instance created for "parentNode" is not the same as 
"document", which is used for "child"
-> so parentNode.appendChild(child) raises an error

What I don't understand is precisely which code change is causing this 
error, since this was working recently (wednesday IIRC). Maybe a 
side-effect of something else ? I'm a bit lost, frankly - any ideas ?

--
Wolfgang

P.S. BTW maybe the interface o.a.l.cms.repository.Node should be called 
something else; it is too easy to confuse with org.w3c.dom.Node (I don't 
think the different package name is sufficient distinction)

Re: [trunk] creating document fails (Was Re: svn commit: r161284 - in lenya/trunk/src/java/org/apache/lenya: ./ cms/ant/ cms/cocoon/acting/ cms/cocoon/components/modules/input/ cms/metadata/dublincore/ cms/metadata/usecases/ cms/publication/ cms/publication/task/ cms/site/usecases/)

Posted by Andreas Hartmann <an...@apache.org>.
J. Wolfgang Kaltz wrote:
> I'm trying to figure out the error regarding document creation in trunk 
> I mentioned earlier today.
> 
> In DefaultSiteTree::addNode() the error occurs at 
> parentNode.appendChild(), namely
>   WRONG_DOCUMENT_ERR: A node is used in a different document than the 
> one that created it. (This is a Java DOM Api error)
> 
> IIUC in that method,
> - "parentNode" is created with "getNodeInternal(parentid)". This 
> ultimately calls load() to create a Document instance;
> - "document" is a document instance created with "Document document = 
> load()"
> - "child" is a new node, created from "document" (via the NamespaceHelper)
> - the document instance created for "parentNode" is not the same as 
> "document", which is used for "child"
> -> so parentNode.appendChild(child) raises an error
> 
> What I don't understand is precisely which code change is causing this 
> error, since this was working recently (wednesday IIRC). Maybe a 
> side-effect of something else ? I'm a bit lost, frankly - any ideas ?

The reason is that SourceNode doesn't store the document but a byte array
since my last commit. I'm fixing the sitetree, I hope I can check it in
on Sunday. Sorry for the inconvenience.

 > P.S. BTW maybe the interface o.a.l.cms.repository.Node should be called
 > something else; it is too easy to confuse with org.w3c.dom.Node (I don't think
 > the different package name is sufficient distinction)

Why could it be confused?
o.a.l.cms.publication.Document and o.w3c.dom.Document would have the same
problem, and o.a.l.c.p.Document is a lot more commonly used in the codebase
than o.a.l.cms.repository.Node.

-- Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org