[jdom-interest] Entities with inner structure

Steve Weiss sweiss at aamc.org
Wed Jun 21 11:49:10 PDT 2000


I've had trouble trying to use Entities also, and it looks to me like
there is a problem in SAXBuilder.java.  In startElement(), at line 561
(beta4 release) there is this:

    if (atRoot) {
        document.setRootElement(element);
        stack.push(element);
        atRoot = false;
    } else {
        ((Element)stack.peek()).addChild(element); <<---- throws
ClassCastException
        stack.push(element);
    }

It looks like the ClassCastException is being thrown when an Entity
comes off the stack rather than an Element. Looking at these two
classes, it seems that both could extend some TBD AbstractXmlThing
class, which might solve this problem (i.e, cast to AbstractXmlThing
instead of Element). Of course, I could be way off on this.

-Steve

Gabor Greif wrote:
> 
> I get an exception when parsing something like
> 
> <tag>
>         &CancelButton;
> </tag>
> 
> where CancelButton is an entity that is not string valued but consists of
> tag(s):
> 
> <!ENTITY CancelButton "<pane type=&#x27;Button&#x27;><ostype
> name=&#x27;id&#x27;>&CancelButtonID;</ostype><string
> name=&#x22;label&#x22;>Cancel</string></pane>" >
> 
> I am using JDOM b4.
> 
> What is the preferred way to use this feature?
> 
> I would propose that a subclass of Entity would be created in the "tag"
> Element, that would have a method for parsing the internal structure of the
> entity and giving back its constituents.
> 
> Any ideas?
> 
> Thanks,
> 
>         Gabor
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

-- 
Steve Weiss      Association of American Medical Colleges
(202)828-0428    mailto:sweiss at aamc.org    http://www.aamc.org



More information about the jdom-interest mailing list