Hi Cristina,
Cristina Stoica <[EMAIL PROTECTED]> wrote on 10/11/2006 05:04:33 AM:
> Thank you for your answer. You were right, it was a bug in my code. What
I
> am trying to do for now is to add a rectangle given as SVG code to a SVG
> image. But now I am getting an illegal character error
This error is in your ECMAScript (javascript) not the SVG:
> Please take a look at my code and at the
> stack trace below; I do not know what I am doing wrong.
> MyJSVGCanvas mycanvas = new MyJSVGCanvas();
> String xml = "<rect x=\"1\" y=\"1\" width=\"50\"
height=\"50\"
> fill=\"none\" stroke=\"green\" />";
>
> Interpreter in = mycanvas.getInterpreter("text/ecmascript");
> SVGDocument doc = (SVGDocument)
> mycanvas.getBridgeContext().getDocument();
> logger.error("!! doc: " + doc.getURL());
> Node n = (Node) in.evaluate("parseXML('" + xml + "'," + doc
+
> ")");
This should probably be something like:
"parseXML('" + xml + "', document)";
The problem is that 'doc' was being stringitized into something
like [SVGOMDocument 0xEEFFEEF] which would make for strange ECMAScript.
In this case you are lucky since the loaded document is already bound
in the interpreter as 'document'. However if you needed to access
another Java variable from ECMAScript you can use:
Interpreter.bindObject("ecmaName", javaObject);
I hope this helps.
> ERROR 11 Oct 2006 11:28:45,953 ImagesManager -
> SyntaxError: illegal character (<SVG>; line 1)
> at
>
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:597)
> at
>
org.mozilla.javascript.TokenStream.reportSyntaxError(TokenStream.java:1324)
> at org.mozilla.javascript.TokenStream.getToken(TokenStream.java:1302)
> at org.mozilla.javascript.Parser.memberExprTail(Parser.java:1213)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]