[jdom-interest] SAXBuilder and custom JDOMFactory

philip.nelson at omniresources.com philip.nelson at omniresources.com
Mon Sep 17 16:56:42 PDT 2001


> 
> I am quite new to JDOM, and am trying to subclass Element and Document
> classes, which is almost done. The problem is when I want to create my
> custom Document (XMLDocument) using SAXBuilder and my custom factory,
> which redefines Element and Document creation to return my subclasses
> instances.
> 
> When using SAXBuilder with my customized classes I get the following
> error:
> 
>      [java] New root elem is:[Element: <Configuration/>]
>      [java]  of type:class net.sourceforge.spedit.core.XMLElement
>      [java] org.jdom.IllegalAddException: The element "Configuration"
> could not be added as the root of the document: The element 
> already has
> an existing parent (the document root)


Without seeing your code its only a guess, but maybe you have a call to
super() somewhere that has already created your document and added it to an
element.



More information about the jdom-interest mailing list