Hello again. In my valiant attempt to create a game with Batik/Java/SVG, I
have run into another snag, one that I really need to have resolved TODAY,
before the game goes online.

One of the SVG files that I use calls an ECMAScript file that contains many
lines that use the parseXML() function, like the following:

var cursor = parseXML("<rect id='textcursor' x='0' y='1' width='4'
height='5' style='fill:#ffffff;visibility:hidden;'><animate id='cursorblink'
attributeName='opacity' attributeType='CSS' values='1;0;1' dur='1s'
repeatCount='indefinite' /></rect>", document)

Now, when I run the applet that renders this SVG file locally (that is, by
clicking the "Run" button in Eclipse), it works without a hitch. However,
when I run the applet in a browser, and only when I run the applet in a
browser, it gives me the following exception:

InterpExcept: org.apache.batik.script.InterpreterException: Wrapped
java.lang.NullPointerException (s91textbox.js#9)
Wrapped java.lang.NullPointerException (s91textbox.js#9)
org.mozilla.javascript.WrappedException: Wrapped
java.lang.NullPointerException (s91textbox.js#9)
        at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Unknown Source)
        at org.mozilla.javascript.MemberBox.invoke(Unknown Source)
        at org.mozilla.javascript.FunctionObject.call(Unknown Source)
        at org.mozilla.javascript.Interpreter.interpretLoop(Unknown Source)
        at script(s91textbox.js:9)
        at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
        at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
        at org.apache.batik.script.rhino.BatikSecurityController$1.run(Unknown
Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at
org.apache.batik.script.rhino.BatikSecurityController.callWithDomain(Unknown
Source)
        at org.mozilla.javascript.Interpreter.interpret(Unknown Source)
        at org.mozilla.javascript.InterpretedFunction.call(Unknown Source)
        at org.mozilla.javascript.ContextFactory.doTopCall(Unknown Source)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(Unknown Source)
        at org.mozilla.javascript.InterpretedFunction.exec(Unknown Source)
        at org.mozilla.javascript.Context.evaluateReader(Unknown Source)
        at org.apache.batik.script.rhino.RhinoInterpreter$2.run(Unknown Source)
        at org.mozilla.javascript.Context.call(Unknown Source)
        at org.mozilla.javascript.ContextFactory.call(Unknown Source)
        at org.apache.batik.script.rhino.RhinoInterpreter.evaluate(Unknown 
Source)
        at org.apache.batik.bridge.BaseScriptingEnvironment.loadScripts(Unknown
Source)
        at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown
Source)
        at org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(Unknown
Source)
        at org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(Unknown Source)

I have no idea what causes the NullPointerException in the Web browser, but
my first assumption would be that it has something to do with Applet
security. I tried replacing the parseXML() function with standard DOM
functions (createElement, setAttribute, etc.) , but that caused a host of
other problems, such as CSS attributes not working and text elements not
being recognized as text elements.

How do I avoid this NullPointerException and make parseXML() work in a Web
browser? I need this solution, and FAST, because the game is scheduled to go
online tomorrow!
-- 
View this message in context: 
http://www.nabble.com/parseXML%28%29-from-ECMAScript-causes-NullPointerException%2C-but-only-in-applet-tp14785363p14785363.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to