xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Halna <christophe.ha...@tomao.fr>
Subject script - unknown language text/ecmascript
Date Wed, 23 Oct 2002 15:38:00 GMT
Hello,

Im trying to view an .svg file 
containing script with an applet using JSVGCanvas

the <script> in the svg file causes the error :

java.lang.Exception: Unknown language: text/ecmascript
      at org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent
(Unknown Source)....

Here are the files (very simple), if someone can have a look and tell me what 
is wrong or what I should try, I would apreciate.

Christophe.

-----------------------------------------------------------------
SvgApplet.java

import javax.swing.*;
import org.apache.batik.swing.*;

public class SvgApplet extends JApplet {
  public void init() {
    JSVGCanvas svgCanvas = new JSVGCanvas();
    svgCanvas.setURI("http://localhost/applet/exemple.svg");
    getContentPane().add(svgCanvas);
  }
}

-----------------------------------------------------------------
exemple.svg

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">

<svg xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink">

    <script type="text/ecmascript" ><![CDATA[

        function changeColor(evt) {
            var rect = evt.getTarget();
            rect.setAttribute( "fill", "purple")
        }

    ]]></script>

    <rect x="5" y="5" width="40" height="40" fill="red" onclick="changeColor
(evt)"/>
</svg>

-----------------------------------------------------------------
SvgApplet.html

<HTML>
<HEAD>
</HEAD>
<BODY BGCOLOR="000000">
<CENTER>
<APPLET
	code	= "SvgApplet.class"
	archive = "batik-awt-util.jar,batik-bridge.jar,batik-css.jar,batik-
dom.jar,batik-ext.jar,batik-extension.jar,batik-gui-util.jar,batik-
gvt.jar,batik-parser.jar,batik-script.jar,batik-svg-dom.jar,batik-
svggen.jar,batik-swing.jar,batik-transcoder.jar,batik-util.jar,batik-
xml.jar,crimson-parser.jar,dom.jar,js.jar,sax.jar"
	width	= "1000"
	height = "600"
	>
</APPLET>
</CENTER>
</BODY>
</HTML>

-----------------------------------------------------------------




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


Mime
View raw message