Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-1374

DOM tree cannot be built for a SVG graphic embedded in a FO file

    XMLWordPrintableJSON

Details

    • 42617

    Description

      I try to apply FOP 0.93 (the stable released version) on the file
      http://xmlgraphics.apache.org/fop/dev/fo/embedding.fo to get a PDF result and I
      get a ClassCastException when the DOM tree is built for an embedded SVG graphic:

      Jun 8, 2007 5:50:56 PM org.apache.fop.cli.Main startFOP
      SEVERE: Exception
      javax.xml.transform.TransformerException: java.lang.ClassCastException:
      org.apache.batik.dom.GenericElement cannot be ca
      st to org.w3c.dom.svg.SVGSVGElement
      at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:168)
      at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
      at org.apache.fop.cli.Main.startFOP(Main.java:160)
      at org.apache.fop.cli.Main.main(Main.java:191)

      ---------

      javax.xml.transform.TransformerException: java.lang.ClassCastException:
      org.apache.batik.dom.GenericElement cannot be ca
      st to org.w3c.dom.svg.SVGSVGElement
      at com.icl.saxon.IdentityTransformer.transform(IdentityTransformer.java:61)
      at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
      at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
      at org.apache.fop.cli.Main.startFOP(Main.java:160)
      at org.apache.fop.cli.Main.main(Main.java:191)
      Caused by: java.lang.ClassCastException: org.apache.batik.dom.GenericElement
      cannot be cast to org.w3c.dom.svg.SVGSVGEle
      ment
      at org.apache.batik.dom.svg.SVGOMDocument.getRootElement(Unknown Source)
      at
      org.apache.fop.fo.extensions.svg.SVGElement.getDimension(SVGElement.java:107)
      at
      org.apache.fop.fo.flow.InstreamForeignObject.prepareIntrinsicSize(InstreamForeignObject.java:103)
      at
      org.apache.fop.fo.flow.InstreamForeignObject.getIntrinsicWidth(InstreamForeignObject.java:115)
      at
      org.apache.fop.layoutmgr.inline.AbstractGraphicsLayoutManager.getInlineArea(AbstractGraphicsLayoutManager.jav
      a:129)
      at
      org.apache.fop.layoutmgr.inline.AbstractGraphicsLayoutManager.getNextKnuthElements(AbstractGraphicsLayoutMana
      ger.java:238)
      at
      org.apache.fop.layoutmgr.inline.LineLayoutManager.collectInlineKnuthElements(LineLayoutManager.java:658)
      at
      org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElements(LineLayoutManager.java:593)
      at
      org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:284)

      at
      org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:113)
      at
      org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:106)
      at
      org.apache.fop.layoutmgr.PageSequenceLayoutManager$PageBreaker.getNextKnuthElements(PageSequenceLayoutManager
      .java:272)
      at
      org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:554)
      at
      org.apache.fop.layoutmgr.PageSequenceLayoutManager$PageBreaker.getNextBlockList(PageSequenceLayoutManager.jav
      a:264)
      at
      org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:301)
      at
      org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:263)
      at
      org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:157)
      at
      org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:385)
      at
      org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:148)
      at
      org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:378)
      at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:194)
      at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
      at
      org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
      at
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
      Source)
      at
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at com.icl.saxon.IdentityTransformer.transform(IdentityTransformer.java:59)
      ... 4 more
      ---------
      java.lang.ClassCastException: org.apache.batik.dom.GenericElement cannot be cast
      to org.w3c.dom.svg.SVGSVGElement
      at org.apache.batik.dom.svg.SVGOMDocument.getRootElement(Unknown Source)
      at
      org.apache.fop.fo.extensions.svg.SVGElement.getDimension(SVGElement.java:107)
      at
      org.apache.fop.fo.flow.InstreamForeignObject.prepareIntrinsicSize(InstreamForeignObject.java:103)
      at
      org.apache.fop.fo.flow.InstreamForeignObject.getIntrinsicWidth(InstreamForeignObject.java:115)
      at
      org.apache.fop.layoutmgr.inline.AbstractGraphicsLayoutManager.getInlineArea(AbstractGraphicsLayoutManager.jav
      a:129)
      at
      org.apache.fop.layoutmgr.inline.AbstractGraphicsLayoutManager.getNextKnuthElements(AbstractGraphicsLayoutMana
      ger.java:238)
      at
      org.apache.fop.layoutmgr.inline.LineLayoutManager.collectInlineKnuthElements(LineLayoutManager.java:658)
      at
      org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElements(LineLayoutManager.java:593)
      at
      org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:284)

      at
      org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:113)
      at
      org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:106)
      at
      org.apache.fop.layoutmgr.PageSequenceLayoutManager$PageBreaker.getNextKnuthElements(PageSequenceLayoutManager
      .java:272)
      at
      org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:554)
      at
      org.apache.fop.layoutmgr.PageSequenceLayoutManager$PageBreaker.getNextBlockList(PageSequenceLayoutManager.jav
      a:264)
      at
      org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:301)
      at
      org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:263)
      at
      org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:157)
      at
      org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:385)
      at
      org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:148)
      at
      org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:378)
      at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:194)
      at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
      at
      org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
      at
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
      Source)
      at
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at com.icl.saxon.IdentityTransformer.transform(IdentityTransformer.java:59)
      at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:165)
      at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
      at org.apache.fop.cli.Main.startFOP(Main.java:160)
      at org.apache.fop.cli.Main.main(Main.java:191)

      I have Xerces-J 2.9.0 and Saxon 6.5 in the classpath of the command line which
      applies FOP to embedding.fo and I try to get a PDF result.

      Attachments

        Activity

          People

            fop-dev@xmlgraphics.apache.org fop-dev
            sorin@oxygenxml.com Sorin Ristache
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: