Hello Miguel. Miguel Bento: > The SVG content is stored as a string, passed as an argument, and i wanted > to use Batik to construct a GVT tree, so that i could then iterate the tree, > and construct the Graphic Objects in my application. Pretty simple.. but, i > only found examples using URI to construct the GVT tree.. so any > help/pointers would be appreciated.
To get an SVGDocument instance from your string, you’ll need to use the SAXSVGDocumentBuilder class, like this, assuming ‘content’ has your SVG content as XML: import org.apache.batik.dom.svg.SAXSVGDocumentFactory; import org.apache.batik.util.XMLResourceDescriptor; import java.io.StringReader; … String content = …; SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(XMLResourceDescriptor.getXMLParserClassName()); SVGDocument doc = f.createSVGDocument(null, new StringReader(content)); (Untested code, but should be the right approach.) And once you have the SVGDocument instance, you can do the stuff from your example to build the graphics tree (using GVTBuilder). -- Cameron McCormack ≝ http://mcc.id.au/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
