Hi,

 

During trancoding of an SVG DOM Document I get an error relating to my "D" syntax in my Path Element, although the SVG is rendered fine in the browser.

 

----------------------------------------------------------------

 

The stack trace is:

 

The attribute "d" of the element <path> is invalid

        at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown S

ource)

        at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown S

ource)

        at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown S

ource)

        at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown S

ource)

        at com.mango.svg.SVGManager.streamSVGIntoImageFormat(SVGManager.java:239

)

 

----------------------------------------------------------------

 

The path is defined thus:

 

            Element circle_light = doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, SVG12Constants.SVG_PATH_TAG);

            circle_light.setAttributeNS(null,"id", CIRCLE_BLANK);

            circle_light.setAttributeNS(null,"stroke-width", "0.2");

            circle_light.setAttributeNS(null,"fill", "white");

            circle_light.setAttributeNS(null,"d", "M0.4,-0.4 a0.7,0.7 0 0.7,0 0.1,0.1 z");

                        defs.appendChild(circle_light);

 

----------------------------------------------------------------

 

The following definition works fine in both browser and transcoding:

 

            Element path_square_blank = doc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI, SVG12Constants.SVG_PATH_TAG);

            path_square_blank.setAttributeNS(null,"id", SQUARE_BLANK);

            path_square_blank.setAttributeNS(null,"stroke-width", "0.2");

            path_square_blank.setAttributeNS(null,"fill", "white");

            path_square_blank.setAttributeNS(null,"d", "M-0.75 -0.75,L0.75 -0.75,L0.75 0.75,L-0.75 0.75,z");

            defs.appendChild(path_square_blank);

 

----------------------------------------------------------------

 

I found the following post in the archive which is related to this matter:

 

http://koala.ilog.fr/batik/mlists/batik-dev/archives/msg05084.html

 

And so have also tried removing all commas from my "D" attribute. This didn't change anything in that the circle was still rendered in the browser, but couldn’t be transcoded.

 

Is there anyway to modify the syntax of my path so that Batik will accept it?

 

Thanks very much in advance,

 

Kind regards,

Dylan

Reply via email to