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

  • Home
  • SEARCH
  • 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 6660641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:10:49+00:00 2026-05-26T02:10:49+00:00

I am using rhino1_7R2. I have found that the following program causes syntax error(illegally

  • 0

I am using rhino1_7R2. I have found that the following program causes syntax error(illegally formed XML syntax):

function b(node) { 
   return <span>{node}{node}</span>;  
}
a=<span>foo {b(<div>bar</div>)} baz</span>;
alert(a);

but it works:

function b(node) { 
   return <span>{node}{node}</span>;  
}
var bar=<div>bar</div>;
a=<span>foo {b(bar)} baz</span>;
alert(a);

It seems to that Rhino does not allow litral xml in { expression }.
First I thought that the ECMAScript specification prohibits this.
But in Firefox(3.6.23) allowed this syntax. So it may be not because ECMA specification.

This is test page run in Firefox(it works):

<script>
    function b(node) { 
        return <span>{node}{node}</span>;  
    }
    a=<span>foo {b(<div>bar</div>)} baz</span>;
    alert(a);
</script>

Can someone tell it is because Rhino’s bug or specifications of either Rhino or Ecmascript?

I will attach test code in Java/Rhino. Regards.

import org.mozilla.javascript.Context;
import org.mozilla.javascript.ScriptableObject;


public class Main {
    public static void main(String[] args) {
        Context c=Context.enter();
        ScriptableObject scope = c.initStandardObjects();
        String source_OK = 
                "function b(node) { " +
                "   return <span>{node}{node}</span>;" +
                "}" +
                "var bar=<div>bar</div>;" +
                "a=<span>foo {b(bar)} baz</span>;   ";
        Object a=c.evaluateString(scope, source_OK, "TEST", 1, null);
        System.out.println(a);

        String source_NG = 
            "function b(node) { " +
            "   return <span>{node}{node}</span>;" +
            "}" +
            "a=<span>foo {b(<div>bar</div>)} baz</span>;   ";
        a=c.evaluateString(scope, source_NG, "TEST", 1, null); //Error!
        System.out.println(a);
        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-26T02:10:50+00:00Added an answer on May 26, 2026 at 2:10 am

    Sorry, I have found that it is a bug of Rhino by myself:

    https://bugzilla.mozilla.org/show_bug.cgi?id=323890

    I also sended a patch for this bug.

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

Sidebar

Related Questions

I have just started using Rhino mocks and I am having difficulty doing that.
I have just crafted the following test using Rhino mocks. Does my test look
For my java program I'm using Rhino to execute JS scripts. Now I'm trying
i am using tomcat server and i have added a rhino engine to able
is there any example on using java method to call rhino-javascript function and return
Using online interfaces to a version control system is a nice way to have
Using ASP.NET MVC there are situations (such as form submission) that may require a
I have been successfully using my code with the javascript library in the ANTLR
Is it possible to test that a property setter has not been called using
Does anyone have an implementation lying around of an auto-mock container using Rhino Mocks

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.