Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-1090

Embedded SVG reports "Content is not allowed in prolog"

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.7, 1.8
    • Fix Version/s: None
    • Component/s: Bridge, SVG Rasterizer
    • Labels:
      None
    • Environment:
      Both Ubuntu and OS X Yosemite

      Description

      I have the following svg:
      https://www.dropbox.com/s/yx06wrzwx7y5eih/outer.svg?dl=0

      When I try to rasterize it with Batik, I get the exception

      org.apache.batik.bridge.BridgeException: Content is not allowed in prolog.
      	at org.apache.batik.bridge.BridgeContext.getReferencedNode(BridgeContext.java:780)
      	at org.apache.batik.bridge.BridgeContext.getReferencedElement(BridgeContext.java:796)
      	at org.apache.batik.bridge.CSSUtilities.convertClipPath(CSSUtilities.java:719)
      	at org.apache.batik.bridge.AbstractGraphicsNodeBridge.buildGraphicsNode(AbstractGraphicsNodeBridge.java:146)
      	at org.apache.batik.bridge.SVGShapeElementBridge.buildGraphicsNode(SVGShapeElementBridge.java:92)
      	at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:224)
      	at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      	at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
      	at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      	at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
      	at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      	at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
      	at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      	at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
      	at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      	at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:141)
      	at org.apache.batik.bridge.SVGImageElementBridge.createSVGImageNode(SVGImageElementBridge.java:660)
      	at org.apache.batik.bridge.SVGImageElementBridge.createImageGraphicsNode(SVGImageElementBridge.java:288)
      	at org.apache.batik.bridge.SVGImageElementBridge.buildImageGraphicsNode(SVGImageElementBridge.java:177)
      	at org.apache.batik.bridge.SVGImageElementBridge.createGraphicsNode(SVGImageElementBridge.java:119)
      	at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:213)
      	at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      	at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
      	at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      	at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
      	at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      	at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:82)
      	at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:208)
      	at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:92)
      	at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
      	at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
      at <my_code>
      
      Exception in thread "Animation Thread" org.apache.batik.transcoder.TranscoderException: null
      Enclosed Exception:
      Content is not allowed in prolog.
      	at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:227)
      	at org.apache.batik.transcoder.image.ImageTranscoder.transcode(ImageTranscoder.java:92)
      	at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
      	at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
      	at <my_code>
      

      I tried decoding the embedded base64 SVG, and batik rasterized it correctly.
      Here it is: https://dl.dropboxusercontent.com/u/73774/svg/inner.svg

      I tried inspecting the issue a bit, and the problem seems to be that the URLs in the embedded SVG that are in the form url(#SVGID_6_) are transformed to the form data:,#SVGID_6_ which seems to cause the problem.

        Attachments

        1. ParsedURLDataProtocolHandler.patch
          1 kB
          Hussein Shafie
        2. outer.svg
          3 kB
          Simon Sotak
        3. inner.svg
          2 kB
          Simon Sotak

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              the21st Simon Sotak
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: