You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Alice Mello Cavallo <me...@media.mit.edu> on 2003/08/12 00:51:39 UTC
Simple java program to open a SVG file
Hi all,
I am trying to understand how all works, but the batik project is to
complex for me, and I have not found any documentation or tutorial on how
to use the basic implemented features.
I am trying the program below, but get the SVG Error:
Unable to make sense of URL for connection
Does it mean that I can not open a local file, but only remote ones?
I will appreciate any input,
Alice
>/*
> * Created on Aug 11, 2003
> *
> * To change the template for this generated file go to
> * Window>Preferences>Java>Code Generation>Code and Comments
> */
>package org.apache.batik.apps.svgbrowser;
>
>import org.apache.batik.swing.JSVGCanvas;
>
>/**
> * @author Alice Mello
> *
> * To change the template for this generated type comment go to
> * Window>Preferences>Java>Code Generation>Code and Comments
> */
>public class OpenSVG {
>
>
>/**
> *
> */
>// JSVGViewerFrame vf = new JSVGViewerFrame();
>public OpenSVG() {
>super();
>// TODO Auto-generated constructor stub
>}
>
> public static void main(String[] args) {
>JSVGCanvas csvg = new JSVGCanvas();
>csvg.loadSVGDocument("C:/Program
>Files/eclipse-SDK-2.1.1-win32/eclipse/workspace/Batik/samples/3D.svg");
>
>}
>}
Re: Simple java program to open a SVG file
Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Alice,
Alice Mello Cavallo wrote:
> I am trying to understand how all works, but the batik project is to
> complex for me, and I have not found any documentation or tutorial on
> how to use the basic implemented features.
Don't give up now you are _very_ close. To be fair a lot
of your issues have been more Java issues (class path, jar files,
packages) than true Batik issues. Please keep in mind that Batik
implements a 600 page specification that builds on several other
multi-hundred page specifications (CSS2, DOM, DOM Events), it needs
to be a large library. Anyone on to the problem at hand.
> I am trying the program below, but get the SVG Error:
>
> Unable to make sense of URL for connection
>
> Does it mean that I can not open a local file, but only remote ones?
>
> I will appreciate any input,
C:/Program... is not a URL it is a platform file reference.
The best way to turn this into a URL is something like:
java.io.File file = new File("C:/Program...");
java.net.URL url = file.toURL();
csvg.loadSVGDocument(url.toString());
The url version of this file ref would look something like:
file://C:/Program....
But File.toURL will get it right for you - so use that.
>> csvg.loadSVGDocument( "C:/Program
>> Files/eclipse-SDK-2.1.1-win32/eclipse/workspace/Batik/samples/3D.svg" );
>>
>> }
>> }
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org