From: Lars H. <he...@se...> - 2007-02-12 17:30:44
|
Hi Darina, [...] > Collection vc = bn.getVariants(); > Iterator it = vc.iterator(); > while (it.hasNext()) { > Variant var = (Variant) it.next(); > Iterator si = > var.getScope().iterator(); > if (si.hasNext()){ > Topic param = (Topic)si.next(); > //***Exception Here**** > I get: JavaLangClassCastException: > Org.TM4J.TopicMap.Memory.TopicMapImpl Are you sure that your "Variant" is a "org.tmapi.core.Variant" and not a "org.tm4j.topicmap.Variant"? I've the suspicion that you mix up the classes from TM4J and TMAPI by mistake. The name bound to "bn" must be an instance of type "org.tmapi.core.TopicName". If it is an instance of "org.tm4j.topicmap.BaseName", your iterator returns variants of type "org.tm4j.topicmap.Variant" and these instances return objects of type "org.tm4j.topicmap.Topic" if you call "getScope()". Please check if you're working with the TMAPI interfaces only. If you need to work with TM4J interfaces *and* TMAPI interfaces, the class "org.tm4j.tmapi.helpers.Wrapper" may help you to 'wrap' and 'unwrap' objects into both directions. Best regards, Lars -- http://www.semagia.com http://www.topicgarden.com/mailinglist/ German Topic Maps mailinglist |