cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gaston Martini <hgmart...@ciudad.com.ar>
Subject Java stream into pipeline?
Date Mon, 12 Sep 2005 22:59:50 GMT
Hi all

Our problem is this: we need to embed a dynamically generated SVG chart into an XHTML page
(also dynamically generated).

THIS IS OUR APPROACH:
We have an SVG chart in a java stream generated by Batik. We need to insert it into a pipeline
and serialize it.

In Java code:
	... create a JFreeChart ...
	JFreeChart chart = ChartFactory.create...
       Document document = GenericDOMImplementation.getDOMImplementation().createDocument(null,
"svg", null);
       SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
       chart.draw(svgGenerator, new Rectangle2D.Double(0, 0, 400, 300), null);
	... create an output stream ...
       Writer out = new ...
       svgGenerator.stream(out, true); // now 'out' has the svg code we want
	...

In the XHTML page:
	...
        <object type="image/svg+xml" data="chart" ...> <!-- this object gets its
data from the 'chart' pipeline -->
            ...
        </object>
	...

In the sitemap
	<map:match pattern="chart">
		???? how do we get the svg in here?
       	<map:serialize type="svgxml"/>
	</map:match>



AND THE QUESTION:
¿How can we get the stream into the pipeline? OR ¿is there a better way to do it?

Thanks in advance

Martín and Gastón
Mime
View raw message