xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fiebig, Sebastian" <Sebastian.Fie...@danet.de>
Subject Add an id to elements providing meta information
Date Thu, 26 Mar 2009 14:32:51 GMT



When trying to add an id attribute to elements just created using
SVGGraphics2D, all elements get deleted. This is caused by the method
getRoot() which calls getRoot(null). But why?

Here is my code:


Node elem = svgGenerator.getRoot(); 

while (elem.getLastChild() != null) {

    elem = elem.getLastChild();


Element lastElement = (Element)elem;

lastElement.setAttribute("id", "1");


This example comes from here:


My initial intention was to add links to my SVG elements. So this
approach seems to be the best and only. After providing ids I could add
links easily. If one has got another approach, I would appreciate it
very much!


Sincerely yours,




View raw message