From: Kal A. <ka...@te...> - 2001-10-01 19:19:01
|
Hi David, At 17:10 01/10/2001 +0200, geo...@hu... wrote: >Hi, could anybody please post some lines of code how to write a XTM-file >from scratch? > >TIA, david > >Got no success with the following... > > > File file = new File("xtmtest01.xml"); > TopicMapFactory tmf = new TopicMapFactoryImpl(); > > TopicMap tm = tmf.createTopicMap(); > URL xtmurl = new URL("http://topicmap.techquila.com/default"); > tm.setBase(xtmurl); > tm.setName("firststopicmap"); > tm.setID("tmId"); > > Topic topic = tmf.createTopic("justAnId"); > tm.addTopic(topic); You didn't say what error you are getting but I guess it is probably a DuplicateTopicException. This is because TopicMapFactory.createTopic() also adds the topic to the topic map. So if you remove the last line above (tm.addTopic(...)) then it should work! Cheers, Kal |