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 J Aaron Farr <ja...@yahoo.com> on 2002/07/06 04:32:24 UTC
Why do I get: Unknown language: text/ecmascript
Okay, I'm running a test here trying to load SVG which has been generated by
the SVGGraphics2D converter to a SVGCanvas object. If anyone knows of an
easier way let me know.
If I use this method, everything works fine:
String svg = generateSVG(doc);
System.out.println(svg);
StringReader sr = new StringReader(svg);
SAXSVGDocumentFactory df = new
SAXSVGDocumentFactory("org.apache.xerces.parsers.SAXParser");
SVGOMDocument svgDoc = df.createDocument(null,sr);
svgCanvas.setSVGDocument(svgDoc);
// File f = new File("test.svg");
// svgCanvas.setURI(f.toURL().toString());
java.lang.Exception: Unknown language: text/ecmascript
at
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown
Source)
at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown Source)
at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
java.lang.NullPointerException
at java.net.URLClassLoader.getPermissions(URLClassLoader.java:422)
at org.apache.batik.script.rhino.RhinoClassLoader.getPermissions(Unknown
Source)
at org.apache.batik.script.rhino.RhinoClassLoader.<init>(Unknown Source)
at org.apache.batik.script.rhino.RhinoInterpreter.<init>(Unknown Source)
at
org.apache.batik.script.rhino.RhinoInterpreterFactory.createInterpreter(Unknown
Source)
at org.apache.batik.script.InterpreterPool.createInterpreter(Unknown Source)
at org.apache.batik.bridge.BridgeContext.getInterpreter(Unknown Source)
at
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown
Source)
at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown Source)
at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Why do I get: Unknown language: text/ecmascript
Posted by Vincent Hardy <vi...@sun.com>.
Hello again,
I just committed a fix for this problem, so I will not work after you
do a CVS update.
Cheers,
Vincent.
Vincent Hardy wrote:
>
> Hello,
>
> This is due to the input document having a null URL. I'll fix this for
> the RhinoClassLoader. In the meanwhile, you can set a dummy URL on the
> document, something like:
>
> ((SVGOMDocument)doc).setURLObject(new
> java.net.URL("file:/c:/temp/dummy.svg"));
>
> Vincent.
>
> J Aaron Farr wrote:
> >
> > Okay, I'm running a test here trying to load SVG which has been generated by
> > the SVGGraphics2D converter to a SVGCanvas object. If anyone knows of an
> > easier way let me know.
> >
> > If I use this method, everything works fine:
> >
> > String svg = generateSVG(doc);
> > System.out.println(svg);
> > StringReader sr = new StringReader(svg);
> > SAXSVGDocumentFactory df = new
> > SAXSVGDocumentFactory("org.apache.xerces.parsers.SAXParser");
> > SVGOMDocument svgDoc = df.createDocument(null,sr);
> >
> > svgCanvas.setSVGDocument(svgDoc);
> > // File f = new File("test.svg");
> > // svgCanvas.setURI(f.toURL().toString());
> >
> > java.lang.Exception: Unknown language: text/ecmascript
> > at
> > org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown
> > Source)
> > at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown Source)
> >
> > at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
> >
> > java.lang.NullPointerException
> >
> > at java.net.URLClassLoader.getPermissions(URLClassLoader.java:422)
> >
> > at org.apache.batik.script.rhino.RhinoClassLoader.getPermissions(Unknown
> > Source)
> >
> > at org.apache.batik.script.rhino.RhinoClassLoader.<init>(Unknown Source)
> >
> > at org.apache.batik.script.rhino.RhinoInterpreter.<init>(Unknown Source)
> >
> > at
> > org.apache.batik.script.rhino.RhinoInterpreterFactory.createInterpreter(Unknown
> > Source)
> >
> > at org.apache.batik.script.InterpreterPool.createInterpreter(Unknown Source)
> >
> > at org.apache.batik.bridge.BridgeContext.getInterpreter(Unknown Source)
> >
> > at
> > org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown
> > Source)
> >
> > at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown Source)
> >
> > at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Sign up for SBC Yahoo! Dial - First Month Free
> > http://sbc.yahoo.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> > For additional commands, e-mail: batik-users-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Why do I get: Unknown language: text/ecmascript
Posted by Vincent Hardy <vi...@sun.com>.
Hello,
This is due to the input document having a null URL. I'll fix this for
the RhinoClassLoader. In the meanwhile, you can set a dummy URL on the
document, something like:
((SVGOMDocument)doc).setURLObject(new
java.net.URL("file:/c:/temp/dummy.svg"));
Vincent.
J Aaron Farr wrote:
>
> Okay, I'm running a test here trying to load SVG which has been generated by
> the SVGGraphics2D converter to a SVGCanvas object. If anyone knows of an
> easier way let me know.
>
> If I use this method, everything works fine:
>
> String svg = generateSVG(doc);
> System.out.println(svg);
> StringReader sr = new StringReader(svg);
> SAXSVGDocumentFactory df = new
> SAXSVGDocumentFactory("org.apache.xerces.parsers.SAXParser");
> SVGOMDocument svgDoc = df.createDocument(null,sr);
>
> svgCanvas.setSVGDocument(svgDoc);
> // File f = new File("test.svg");
> // svgCanvas.setURI(f.toURL().toString());
>
> java.lang.Exception: Unknown language: text/ecmascript
> at
> org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown
> Source)
> at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown Source)
>
> at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
>
> java.lang.NullPointerException
>
> at java.net.URLClassLoader.getPermissions(URLClassLoader.java:422)
>
> at org.apache.batik.script.rhino.RhinoClassLoader.getPermissions(Unknown
> Source)
>
> at org.apache.batik.script.rhino.RhinoClassLoader.<init>(Unknown Source)
>
> at org.apache.batik.script.rhino.RhinoInterpreter.<init>(Unknown Source)
>
> at
> org.apache.batik.script.rhino.RhinoInterpreterFactory.createInterpreter(Unknown
> Source)
>
> at org.apache.batik.script.InterpreterPool.createInterpreter(Unknown Source)
>
> at org.apache.batik.bridge.BridgeContext.getInterpreter(Unknown Source)
>
> at
> org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown
> Source)
>
> at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown Source)
>
> at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
>
> __________________________________________________
> Do You Yahoo!?
> Sign up for SBC Yahoo! Dial - First Month Free
> http://sbc.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org
Re: Why do I get: Unknown language: text/ecmascript (One more time)...
Posted by J Aaron Farr <ja...@yahoo.com>.
My email client decided to send that off before I was ready. I'm sorry.
I'm trying to load a SVGCanvas with SVG generated by the SVGGraphics2D
generator. If there's an easier way, let me know! However, I tried the
following two methods and while they look to be correct to me, the second
throws and odd error about emcascript.
If I use this method, everything works fine:
// two methods, the first uses SVGGraphics2D to generate the SVG
public String generateSVG(org.w3c.dom.Document doc) throws Exception {
DOMImplementation domImpl =
GenericDOMImplementation.getDOMImplementation();
Document document = domImpl.createDocument(null, "svg", null);
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
// do the actual Java2D in the paint() method...
this.paint(svgGenerator,doc);
StringWriter sw = new StringWriter();
svgGenerator.stream(sw,true);
return sw.toString();
}
// okay I should now have the SVG as a string right?
// so if I throw it into a file, and then load the URL, everything is
fine...
String svg = generateSVG(doc); // calls the methods listed above
File f = new File("test.svg");
FileWriter fw = new FileWriter(f);
fw.write(svg);
fw.flush();
fw.close();
svgCanvas.setURI(f.toURL().toString());
This works perfectly (I understand it's a round about way to do things, but
hold on for a second...)
If I change that last snippet of code to this:
String svg = generateSVG(doc);
StringReader sr = new StringReader(svg);
SAXSVGDocumentFactory df = new
SAXSVGDocumentFactory("org.apache.xerces.parsers.SAXParser");
SVGOMDocument svgDoc = df.createDocument(null,sr);
svgCanvas.setSVGDocument(svgDoc);
I get the following errors:
java.lang.Exception: Unknown language: text/ecmascript
at
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown
Source)
at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown Source)
at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
java.lang.NullPointerException
at java.net.URLClassLoader.getPermissions(URLClassLoader.java:422)
at org.apache.batik.script.rhino.RhinoClassLoader.getPermissions(Unknown
Source)
at org.apache.batik.script.rhino.RhinoClassLoader.<init>(Unknown Source)
at org.apache.batik.script.rhino.RhinoInterpreter.<init>(Unknown Source)
at
org.apache.batik.script.rhino.RhinoInterpreterFactory.createInterpreter(Unknown
Source)
at org.apache.batik.script.InterpreterPool.createInterpreter(Unknown Source)
at org.apache.batik.bridge.BridgeContext.getInterpreter(Unknown Source)
at
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(Unknown
Source)
at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown Source)
at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)
I'm running with the lastest Batik version (1.5 beta 3). Anyone have any
thoughts?
Thanks!
J Aaron Farr
PS- sorry about the earlier message. First time posting on this list and I
send a half edited message. :)
__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org