WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

E4X

Rhino Javascript implements ECMA-357 ECMAScript for XML (E4X).

Since Rhino 1.7 this is implemented on DOM ( org.w3c.dom.* ).

The following simple example shows the use of E4X ...

var a=world;
a.child="hello again";
context.createResponseFrom(a);

For those not familiar with E4X it provides XML as a native datatype in Javascript. So the example above produces...

<hello> world
  <child>hello again</child>
</hello>

Returning a Javascript XML object returns and instance of org.mozilla.javascript.xmlimpl.XML (which is based on DOM).

Getting at the DOM

This lang:javascript module hosts an overridden Java implementation of the org.mozilla.javascript.xmlimpl.XML object (which is now public rather than package protected) and makes public the method

public org.w3c.dom.Node toDomNode();

Therefore when receiving an XML object response from Javascript you can get at the underlying DOM by calling this method.

XMLToDOM Transreptor

In addition the lang:javascript module provides an XML to DOM transreptor. Therefore in many cases the Javascript XML object will be transrepted dynamically to work with other xml services.