AFAIO the correct syntax is: text2.getFirstChild(). This is the function you
should use in Adobe; from their CurrentSupport.pdf:

"The script engine interface technology available on Netscape for the
Macintosh does not support writable attributes on interfaces. To work around
this limitation, Adobe SVG Viewer supports additional "get/set" methods for
each DOM interface attribute. For cross-browser script compatibility you
should always use these methods instead of the writable attributes listed
below. For example, to read from and write to the attribute nodeValue on the
Node interface, use the methods getNodeValue and setNodeValue, instead."

Does this same syntax work in Batik?


----- Original Message -----
From: "Denis Bohm" <[EMAIL PROTECTED]>
To: "Batik Users" <[EMAIL PROTECTED]>
Sent: Wednesday, August 27, 2003 12:19 AM
Subject: Re: interperter exception


> If I change "text2.firstChild()" to "text2.firstChild" then it works.  I
> assume the second form is the correct one?  And that Adobe is just more
> forgiving...
>
> ----- Original Message -----
> From: "Denis Bohm" <[EMAIL PROTECTED]>
> To: "Batik Users" <[EMAIL PROTECTED]>
> Sent: Tuesday, August 26, 2003 4:06 PM
> Subject: interperter exception
>
>
> > I'm trying to do some scripting within Batik and am getting an exception
> > when trying to call a function on an element.  Anyone have any idea why?
> > (The same SVG works in the Adobe plugin.)
> >
> > <?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="400" onload="setText2('foo')">
> >     <script type="text/ecmascript">
> > function setText2(text) {
> >     var text2 = document.getElementById("text2");
> >     var oldNode = text2.firstChild();
> > }
> >     </script>
> >     <text id="text2" x="60" y="40" text-anchor="end">???</text><text
> x="70"
> > y="40">b/sec</text>
> > </svg>
> >
> >
> > TypeError: [EMAIL PROTECTED] is not a function.
> > (Inline <script>
> >
>
file:/C:/home/denis/sandbox/networkphysics/prototype/sources/com/networkphys
ics/ui/map/demo.svg:-1;
> > line 10)
> >
> >  at
> >
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:597)
> >
> >  at
> >
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:557)
> >
> >  at
org.mozilla.javascript.NativeGlobal.typeError1(NativeGlobal.java:567)
> >
> >  at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1182)
> >
> >  at org.mozilla.javascript.gen.c2.call(Inline <script>
> >
>
file:/C:/home/denis/sandbox/networkphysics/prototype/sources/com/networkphys
ics/ui/map/demo.svg:-1:10)
> >
> >  at
> >
>
org.mozilla.javascript.optimizer.OptRuntime.callSimple(OptRuntime.java:275)
> >
> >  at org.mozilla.javascript.gen.c4.call(Event attribute
> >
>
file:/C:/home/denis/sandbox/networkphysics/prototype/sources/com/networkphys
ics/ui/map/demo.svg:-1
> > onload:1)
> >
> >  at org.mozilla.javascript.gen.c4.exec(Event attribute
> >
>
file:/C:/home/denis/sandbox/networkphysics/prototype/sources/com/networkphys
ics/ui/map/demo.svg:-1
> > onload)
> >
> >  at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
> >
> >  at
> >
>
org.apache.batik.script.rhino.RhinoInterpreter.evaluate(RhinoInterpreter.jav
> > a:257)
> >
> >  at
> >
>
org.apache.batik.bridge.BaseScriptingEnvironment$1.handleEvent(BaseScripting
> > Environment.java:552)
> >
> >  at
> >
>
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.jav
> > a:268)
> >
> >  at
> >
>
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:231
> > )
> >
> >  at
org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:455)
> >
> >  at
> >
>
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoad(BaseScripti
> > ngEnvironment.java:560)
> >
> >  at
> >
>
org.apache.batik.bridge.BaseScriptingEnvironment.dispatchSVGLoadEvent(BaseSc
> > riptingEnvironment.java:492)
> >
> >  at
> >
>
org.apache.batik.bridge.UpdateManager.dispatchSVGLoadEvent(UpdateManager.jav
> > a:185)
> >
> >  at
> >
>
org.apache.batik.swing.svg.SVGLoadEventDispatcher.run(SVGLoadEventDispatcher
> > .java:140)
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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]

Reply via email to