The CCS engine for the document is set in BridgeContext.initializeDocument(), which is called by org.apache.batik.bridge.GVTBuilder.build(). But it seems there is no way to set CCS engine from FOP classes(such as BatikElement). (I do not want to modify Batik source code).
>It also appears that you are trying to map just the flowText element. For the svg elements, FOP extension maps <svg> to SVGElement and all other tags to SVGObj. I am using the same approach for batik extensions: <flowText> to BatikElement and all other tags to BatikObj. BatikElement creates the root document for batik namespace. >The SVG specification is pretty clear that SVG elements must have a parent SVG element It seems Batik requires each child of SVG element must be SVG element( or belongs to same document). <svg> Batik DOM element is created through SVGDOMImplmentation, while <flowText> Batik DOM element is created through ExtensibleSVGOMImplementation. I have to have a different root document for all the batik extension elements, otherwise the system uses SVGDOMImplementation to create generic DOM element. > I think you really want to try and "fix" the existing SVG element mapping stuff in FOP. How to do this? I stuck in this problem now and do not know what to do the next. Can someone please help me implement this batik extension in FOP? Thanks a lot. Jay On Fri, 5 Sep 2003, Thomas DeWeese wrote: > Hi Jay, > > Well the problem you are having is because you haven't setup the > CSS engine for Batik. This is normally done by the batik.bridge.BridgeContext > class in Batik. However, it also appears that you are trying to map just the > flowText element - The SVG specification is pretty clear that > SVG elements must have a parent SVG element - of course you can > try and do it without this but I think it's a mistake. > > I think you really want to try and 'fix' the existing > SVG element mapping stuff in FOP rather than try and reproduce > this work. > > Jay Chiu wrote: > > I solved the element class mapping issue, but still get > > exception at > > org.apache.batik.bridge.CSSUtilities.convertDisplay() because > > getComputedStyle(e, SVGCSSEngine.DISPLAY_INDEX) returns null on > > flowTextElement. If I set the method to return true, then I get > > exception at > > org.apache.batik.bridge.CSSUtilities.convertVisibility() for the > > same reason. > > > > I have added the attached three files: > > (1) BaticElement.java > > (2) BatikElementMapping.java > > (3) BatikObj.java > > and registered BatikElementMapping class with fop. > > > > Because flowTextElement needs its own document object for using > > ExtensibleSVGDOMImplementation to create child elements, I have > > to add addGraphic() into the BatikElement.java file. > > > > Also org.apache.batik.dom.AbstractParentNode does not allow > > adding child with different document object, I have to comment > > out > > if (n.getOwnerDocument() != getCurrentDocument()) > > in checkAndRemove() method. > > > > Pleae help me check what is wrong here. Probably you have add > > the batik extension into next release of FOP. > > > > Thanks. > > > > Jay > > > > > > > > > > ---- On Fri, 5 Sep 2003, Andreas L. Delmelle > > ([EMAIL PROTECTED]) wrote: > > > > > >>>From: Jay Chiu [mailto:[EMAIL PROTECTED] > >>>I got the same exception as what Swapan got. I think the > >>>problem > >> > >>Difficult to tell... ( also because I haven't used Batik > > > > directly ) > > > >>Does this happen with other graphic formats too? What versions > > > > (FOP & Batik) > > > >>are you using? Is FOP being run from the command-line - using > > > > the supplied > > > >>shell script to set its classpath - or embedded? > >> > >>Check http://xml.apache.org/fop/graphics.html#batik to find > > > > out why I think > > > >>these questions are important. > >> > >>Hope this helps ( you both ) > >> > >>Greetz, > >> > >>Andreas Delmelle > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]