Duplicate ids under <defs>

A discussion forum for JFreeSVG (a fast, lightweight, SVG generator for the Java platform).
Locked
remiohead
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm
antibot: No, of course not.

Duplicate ids under <defs>

Post by remiohead » Mon Jun 30, 2014 9:18 pm

When showing more than one SVG document on the same page the shared resources under <defs> have duplicate ids. This is especially problematic with clip refs. We need a method to set a prefix that will be used when creating ids for clips and paints.

remiohead
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm
antibot: No, of course not.

Re: Duplicate ids under <defs>

Post by remiohead » Mon Jun 30, 2014 9:28 pm

This could also be handled automatically by default, while providing the ability to set a custom prefix. When testing a fix for this myself I used the system time as the prefix.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Duplicate ids under <defs>

Post by david.gilbert » Tue Jul 01, 2014 6:55 am

Hi,

I came across this issue already and added this method in the 1.9 release:

http://www.jfree.org/jfreesvg/javadoc/o ... ng.String)

…but I did not think of auto-populating the prefix, that's a very good idea (I will add that for the 2.0 release).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

remiohead
Posts: 201
Joined: Fri Oct 02, 2009 3:53 pm
antibot: No, of course not.

Re: Duplicate ids under <defs>

Post by remiohead » Tue Jul 01, 2014 1:21 pm

Awesome, thanks David. I need to pay closer attention to the change log in the future.

Thanks again for this fantastic tool.

Locked