I follow this link http://wso2.org/library/1050 to perform the
operation.
my build path include: js.jar,axiom-api.-1.2.10jar,axiom-
impl-1.2.10.jar,commons-logging-1.1.1.jar,stax-api-1.0.2.jar,wstx-
asl-3.2.9.jar, js-axiom.jar (source from: 
http://wso2.org/repos/wso2/trunk/wsf/javascript/rhino/)

and I have a test code like this:


 Context cx = Context.enter();
         try {
                 String script = "" +
                         "var xml = <root><node1/><node2/><node3/></
root>;";
                 cx.evaluateString(cx.initStandardObjects(), script,
"", 1, null);
         } catch (Exception e) {
                 e.printStackTrace();
         } finally {
                 Context.exit();
         }

but it throws an error:


org.mozilla.javascript.EcmaError: ReferenceError: "XML" is not
defined. (#1)
 at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:
3654)
 at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:
3632)
 at
org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:
3717)
 at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1692)
 at org.mozilla.javascript.gen.c1._c0(:1)
 at org.mozilla.javascript.gen.c1.call()
 at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:
399)
 at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:
3065)
 at org.mozilla.javascript.gen.c1.call()
 at org.mozilla.javascript.gen.c1.exec()
 at org.mozilla.javascript.Context.evaluateString(Context.java:1112)
 at test.Test.main(Test.java:31)


Why I cannot use the XML? Is there anything that I missed ?


Thank you very much !

_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to