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
 

Hello!

 

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:
http://www.nabble.com/SVGGraphics2D-and-id-td4325094.html

 

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,

 

Sebastian

 


Mime
View raw message