-
Enhancement
-
Resolution: Fixed
-
P5
-
6
-
b126
-
x86
-
windows_xp
-
Verified
A DESCRIPTION OF THE REQUEST :
The JSR-223 interface is great, an excellent addition to Java. And the inclusion of the Mozilla JavaScript is a great choice as well. But to leave out the E4X feature really reduces the utility of JavaScript in this day and age, when running Java outside of a browser. So much of today's software is based on XML and to make it nearly impossible for a JavaScript script to create and parse XML is a severe oversight.
JUSTIFICATION :
The JSR-223 scripting languages are going to be used to extend the functionality of Java written applications. And since so many applications use XML natively, the scripts that extend the applications need an easy way to access XML. E4X is an excellent solution and the Mozilla folks have already solved the problem for you. Leaving it out really limits the utility of the Sun version of JavaScript.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
When you have this in your Mozilla JavaScript script:
var msg = <a><b></b><a>
you should get an XML object in your script.
ACTUAL -
When you run that script through Sun's version of Mozilla JavaScript you get:
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "XML" is not defined. (<Unknown source>#43) in <Unknown source> at line number 43
CUSTOMER SUBMITTED WORKAROUND :
I downloaded the source to see if I could create a parrallel implementation using the real Rhino JavaScript. It appears to me that Sun seriously modified the Mozilla source so it does not appear there is an easy work around.
The JSR-223 interface is great, an excellent addition to Java. And the inclusion of the Mozilla JavaScript is a great choice as well. But to leave out the E4X feature really reduces the utility of JavaScript in this day and age, when running Java outside of a browser. So much of today's software is based on XML and to make it nearly impossible for a JavaScript script to create and parse XML is a severe oversight.
JUSTIFICATION :
The JSR-223 scripting languages are going to be used to extend the functionality of Java written applications. And since so many applications use XML natively, the scripts that extend the applications need an easy way to access XML. E4X is an excellent solution and the Mozilla folks have already solved the problem for you. Leaving it out really limits the utility of the Sun version of JavaScript.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
When you have this in your Mozilla JavaScript script:
var msg = <a><b></b><a>
you should get an XML object in your script.
ACTUAL -
When you run that script through Sun's version of Mozilla JavaScript you get:
javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "XML" is not defined. (<Unknown source>#43) in <Unknown source> at line number 43
CUSTOMER SUBMITTED WORKAROUND :
I downloaded the source to see if I could create a parrallel implementation using the real Rhino JavaScript. It appears to me that Sun seriously modified the Mozilla source so it does not appear there is an easy work around.
- relates to
-
JDK-6980447 Rhino JavaScript engine code in jdk-7 has to updated with the latest code from Rhino 1.7R3
- Closed