[jira] [Created] (BATIK-1220) missing of width/height rect attribute breaks transcoding

"Anton Tarasov (JIRA)" <[email protected]>
Newsgroups gmane.text.xml.batik.devel
Message-ID <[email protected]>
Anton Tarasov created BATIK-1220:
------------------------------------

             Summary: missing of width/height rect attribute breaks transcoding
                 Key: BATIK-1220
                 URL: https://issues.apache.org/jira/browse/BATIK-1220
             Project: Batik
          Issue Type: Bug
          Components: Bridge
    Affects Versions: 1.9
            Reporter: Anton Tarasov
         Attachments: Main.java, image.svg

Consider the following svg:

 
{code:java}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
<!--<rect x="5" y="5" width="10" height="10"/>-->
<rect x="5" y="5"/>
<text x="5" y="12" fill="red" font-size="6">rect</text>
</svg> 
{code}
 

When transcoding this SVG, it's ok when the "rect" element contains with/height attributes, but when they're missing an exception is thrown from SVGRectElementBridge:

 
{code:java}
org.apache.batik.bridge.BridgeException
The attribute "width" of the element <rect> is required{code}

This breaks transcoding completely. However, standard browsers (Chrome/Edge etc.) just ignore the missing and display the rest of the svg content. I can't see any way to tell Batik to behave the same way...

The only workaround I found is to override SVGOMAnimatedLength.createLiveAnimatedLength so that it replaces null default value with "0" for "width/height" in SVGOMRectElement. The code is attached.

Please, advice any better solution if possible. Thank you.

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.