Thank you very much, xml:base attribute idea works fine. Thanks again sent1729
--- In [email protected], [EMAIL PROTECTED] wrote: > > Hi sent1729, > > [email protected] wrote on 05/31/2006 11:20:27 AM: > > > I use Batik as my SVG browser. I am having couple of images > > in my SVG document. How to refer those images inside the SVG > > document by using a relative path to the database. My database could > > sit any where on my computer and I am trying to tie the images > > inside the svg document with respect to the location of the database. > > > My question: > > Is it possible to refer the xlink:href attribute relative to the > > database so that I can avoid the step of writing the doc to a file > > and directly open the doc from the database. > > Yes, in fact there are a number of ways to accomplish this... > > > This is what I do to directly open the doc from the database: > > > TransformerFactory tmf=TransformerFactory.newInstance (); > > Transformer tf=tmf.newTransformer(); > > DOMSource source=new DOMSource(doc); > > StreamResult result=new StreamResult("name of file for > output"); > > I would suggest using a DOMResult with an SVGDocument element > (gotten from: org.apache.batik.dom.svg.SVGDOMImplementation). This > will avoid the need to generate XML and reparse that speeding things > up a bit. > > > tf.transform(source,result); > > > svgRoot = (SVGElement) doc.getDocumentElement(); > > svgCanvas.setDocument(doc); > > Given the above code I'm surprised to see this since I would > have expected you to give the filename from above. > If you have the document in memory as a batik.dom.svg.SVGOMDocument > (Batik's implementation of the SVGDocument interface) then you > can call 'setURLObject(URL baseURL)' to set the URL against which > all relative URL's will be resolved. > > You can also use the 'xml:base' attribute to adjust the base > URL for resolution of relative URL's within subparts of the SVG > tree (or the whole tree if you set it on the root SVG element). > > I hope this helps. > ------------------------ Yahoo! Groups Sponsor --------------------~--> Protect your PC from spy ware with award winning anti spy technology. It's free. http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/1U_rlB/TM --------------------------------------------------------------------~-> ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

