Subj : Getting an XmlObject from E4X changes top level element to xml-fragment To : netscape.public.mozilla.jseng From : torntrousers Date : Sun Mar 13 2005 02:15 pm I'm calling an E4X script function from Java with Rhino and trying to get an XmlObject from the function response, but the XmlObject I get is an xml-fragment. The below code demonstrates the problem, the first two printlns show: but the final println of the XmlObject shows: Am I doing this wrong is this a bug? Thanks again, ...ant public class Test2 { public static void main(String[] args) { Context cx = Context.enter(); try { Scriptable scope = cx.initStandardObjects(null, true); StringBuffer sb = new StringBuffer(); sb.append("function foo() {\n"); sb.append("var s = new Namespace(\"http://foo\");"); sb.append("var envelope = ;"); sb.append("envelope.s::Body=\"\";"); sb.append("java.lang.System.out.println(envelope);"); sb.append("return envelope;\n"); sb.append("}\n"); String script = sb.toString(); Script compiledScript = cx.compileString(script,"bla",1,null); compiledScript.exec(cx, scope); Function foo = (Function) scope.get("foo", scope); Scriptable jsResult = (Scriptable) foo.call(cx, scope, scope, new Object[] {}); System.out.println("jsResult:\n" + jsResult); Wrapper wrap = (Wrapper) ScriptableObject.callMethod(jsResult, "getXmlObject", new Object[0]); XmlObject result = (XmlObject) wrap.unwrap(); System.out.println("result:\n" + result); } finally { Context.exit(); } } } .