xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gorzsás Tamás <Gorzsas.Ta...@evosoft.hu>
Subject referred <def> element is not displayed
Date Thu, 05 Jan 2006 12:01:10 GMT
Hi all,


I'm dealing with maps which are available in SVG format.

I have to put icons onto the map in runtime. The icons are available in separated SVG files.


My idea is that I'm loading the icons element from the SVG file and put them into <defs>



<g id="train-1-purple"> 

                        <polygon i:knockout="Off" fill="#CC66CC" points="0,28 26,28 40,14
26,0 0,0 "/>

                        <polygon i:knockout="Off" points="4,24 24,24 34,14 24,4 4,4 "/>




But I have problem when I use a reference of this def element.

if I place a <use> element in the svg file, the icon will be displayed.

                        <use id="T_3_0_0" xlink:href="#train-1-purple" x="0" y="0" />

if I try to place it from code, it won't be displayed.


                        Element trainImage = canvas.getSVGDocument().createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI,

            trainImage.setAttributeNS(XMLConstants.XLINK_NAMESPACE_URI, "xlink:href", "#train-1-purple");

trainImage.setAttributeNS(null, "id", "T_3_0_0");

trainImage.setAttributeNS(null, "x", "0");

            trainImage.setAttributeNS(null, "y", "0");



Is it a bug in Batik or do I something wrong?




View raw message