xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cameron McCormack <...@mcc.id.au>
Subject Re: Problem - SVG File Reading from memory - Batik
Date Sun, 23 Sep 2007 00:41:09 GMT
Mukt:
> Hi, I am using Batik Library to render SVG File to my Application panel. This
> can be easily done by using setURI(string URL) method of JSVGCanvas. But the
> problem is I can't find any functionality that loads the SVG Image from Byte
> Stream in the memory.
> If I have the SVG file in my memory then I have to dump it into any
> temporary file...and then read it using the above function..which I dont
> want to do ..because it will decrease my program's efficiency...can ne1 help
> me??

You can build an SVGDocument object from a Reader using the
SAXSVGDocumentFactory class:

  http://xmlgraphics.apache.org/batik/using/dom-api.html#createdocfromsvgfile

Instead of using the SAXSVGDocumentFactory.create(String) method, as in
that example, you use SAXSVGDocumentFactory.create(Reader), and pass in
a StringReader that wraps your String containing the XML.

-- 
Cameron McCormack, http://mcc.id.au/
	xmpp:heycam@jabber.org  ▪  ICQ 26955922  ▪  MSN cam@mcc.id.au

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message