I think the problem was that there was trailing whie space after the class name. I removed that and now the Java class is loaded.
Good!
However, the onload event listener doesn't seem to be getting called...
Check the spec, the DOM event names are not the same as the event attributes. 'onload' == 'SVGLoad' There is a table in an appendix that lists them all.
----- Original Message ----- From: "Denis Bohm" <[EMAIL PROTECTED]>
To: "Batik Users" <[EMAIL PROTECTED]>
Sent: Tuesday, September 30, 2003 9:25 PM
Subject: Scripting with Java Error
I'm trying to script using Java according to the SVG 1.1 specification:
http://www.w3.org/TR/SVG11/java.html
But when I try to load my demo.svg file into Squiggle I get:
"SVG Error: com.fireflydesign.svg.SVGHandler
java.lang.ClassNotFoundException: com.fireflydesign.svg.SVGHandler ..."
I checked the archive and it seems to contain the handler class. Anyone have any idea why the class can't be found?
Thanks, Denis
Here is my SVG (demo.svg):
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [ ]> <svg width="600" height="800" viewBox="0 0 600 800" xmlns:xlink="http://www.w3.org/1999/xlink"> <script type="application/java-archive" xlink:href="demo.jar"/> <text x="10" y="20" fill="black">Hello</text> </svg>
Here is my manifest:
Manifest-Version: 1.0 SVG-Handler-Class: com.fireflydesign.svg.SVGHandler
And my Java source:
package com.fireflydesign.svg;
import org.w3c.dom.events.Event; import org.w3c.dom.events.EventListener;
import org.w3c.dom.svg.EventListenerInitializer; import org.w3c.dom.svg.SVGDocument; import org.w3c.dom.svg.SVGSVGElement;
public class SVGHandler implements EventListenerInitializer {
public SVGHandler() { }
public void initializeEventListeners(SVGDocument document) { SVGSVGElement root = document.getRootElement(); EventListener listener = new EventListener() { public void handleEvent(Event event) { System.out.println("onload"); } }; root.addEventListener("onload", listener, false); }
}
---------------------------------------------------------------------------- ----
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]