From: Dicheva, D. <dic...@ws...> - 2008-05-14 14:47:00
|
Hi Lars, Thanks a lot for replying. > > I have a problem in using the removeSubjectLocator(l) method - it just > > doesn't work for me ... > > What does not work? Well, it just doesn't remove the subject locator: When I do: System.out.println("oldSubjectLocator: "+oldSubjectLocator); System.out.println("newSubjectLocator: "+newSubjectLocator); if (!oldSubjectLocator.equals("")) { Locator l = (Locator)t.getSubjectLocators().iterator().next(); System.out.println("loc 1: "+l.getReference()); System.out.println("loc 1: "+l.getNotation()); System.out.println("loc 1: "+l.toString()); t.removeSubjectLocator(l); Locator l2 = (Locator)t.getSubjectLocators().iterator().next(); System.out.println("loc 2: "+l2.getReference()); System.out.println("loc 2: "+l2.getNotation()); System.out.println("loc 2: "+l.toString()); } I get: [java] oldSubjectLocator: c:\\workspace\\TM4L_Plugins\\plugins\\XSLT\\out.xtm [java] newSubjectLocator: c:\\workspace\\TM4L_Plugins\\plugins\\XSLT\\out22.xtm [java] loc 1: c:\\workspace\\TM4L_Plugins\\plugins\\XSLT\\out.xtm [java] loc 1: URI [java] loc 1: org.tm4j.tmapi.core.TMAPILocatorImpl@1048d930 [java] loc 2: c:\\workspace\\TM4L_Plugins\\plugins\\XSLT\\out.xtm [java] loc 2: URI [java] loc 2: org.tm4j.tmapi.core.TMAPILocatorImpl@1048d930 obviously, the locator doesn't get removed, i.e. t.removeSubjectLocator(l); doesn't work ... And of course when after that I try to add the new subject locator, I get the error message that XTM1.0 doesn't allow more than 1 subject locator. > > > I am copying a method to replace a subject locator of a topic with a new > > one - have no idea what I am doing wrong... > > Possible problem: I believe that TM4J manages max. one subject locator > (since XTM 1.0 allows just one). So, if you have a topic with subject > locator "A" and you call your function with > > replaceOldSubjectLocator(t, "B", "C"); > > the existing subject locator ("A") would not have been matched with > "B" and if you add "C", the locator "A" goes away since TM4J handles > just one locator. > (I am not sure if TM4J overrides any existing > subject locator silently). Well, as you can see above, the locators "A" and "B" are the same ... > > Maybe you can drop in [tinyTiM] (for testing purposes) as TMAPI > implementation and see if you get the expected results. tinyTiM > handles 0..n subject locators and is more TMAPI compatible than TM4J. > > [tinyTiM] <http://sf.net/projects/tinytim> Thank you, however, if even I get it working there, this will not solve my problem in TM4L ... Any other idea that I can try? I really appreciate your effort to help. Darina > ------------------------------------------------------------------------ - > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Tm4j-users mailing list > Tm4...@li... > https://lists.sourceforge.net/lists/listinfo/tm4j-users |