Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6965077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:00:26+00:00 2026-05-27T16:00:26+00:00

I couldn’t run following code using JDK 6. It throws an exception: Exception in

  • 0

I couldn’t run following code using JDK 6.
It throws an exception:

Exception in thread “main” org.mozilla.javascript.EcmaError: ReferenceError: “XML” is not defined.

My environment is following: Ubuntu 11.04, JDK 6, Rhino 1.7R2 (also tested with Rhino 1.7R3)

    String script = "function abc(x) {var dd = new XML();}";
    Context context = Context.enter();
    try {
        ScriptableObject scope = context.initStandardObjects();
        Scriptable that = context.newObject(scope);

        Function fct = context.compileFunction(scope, script, "script", 1, null);
        Object result = fct.call(context, scope, that, new Object[] {2});

    }
    catch(Exception e){
        e.printStackTrace();
    }
    finally {
        Context.exit();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:00:27+00:00Added an answer on May 27, 2026 at 4:00 pm

    I had the same problem → in Rhino shell E4X works perfectly, but in embedded mode ­– ReferenceError: “XML” is not defined.

    It was problem with old Xerces, I had 2.6.2 in my classpath when run my app. When I update it to 2.11 problem is gone.

    $ java -cp js.jar:xerces-2.6.2.jar org.mozilla.javascript.tools.shell.Main
    Rhino 1.7 release 3 2011 05 09
    js> var x = <foo/>;
    js: uncaught JavaScript runtime exception: ReferenceError: "XML" is not defined.
    

    and

    $ java -cp js.jar org.mozilla.javascript.tools.shell.Main
    Rhino 1.7 release 3 2011 05 09
    js> var x = <foo/>;
    js> x.toXMLString();
    <foo/>
    

    Looks like when Rhino find Xerces, it uses it, instead of own mechanism to parse XML (when I start Shell with js.jar only in classpath).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I couldn't find anything about getting the total JSON record count using jQuery. Here
Couldn't find a trace of the source code behind the Photos application that runs
Couldn't creatively shorten the title :) I have been using a variation of the
Couldn't find anything relevant in forums So ,Please help me with this code .I'm
Couldn't the diamond problem be resolved just by using the first inherited declaration found?
Couldn't manage chaining calls using coffee script. I'm trying to reproduce this in coffee
Couldn't Create Link Creating the link /usr/bin/mate failed with the following reason: Operation not
I couldn't find a proper discussion thread on this topic, so I'm going to
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Couldn't comment on this post, which states the problem I'm experiencing: jQuery remove() on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.