{" "} E4X Programming Help by Programmers hub

E4X Programming Language

E4X (ECMAScript for XML) is a programming language adds the XML support to the JavaScript. E4X is standardized by Ecma International in ECMA-357 standard. E4X is implemented in SpiderMonkey and in Rhino. E4X provides the XML support which minimizes the complexity of the code and save the execution time of the program. There is ne type of XML which does't support by E4X is parsing XML declaration. E4X have a functionality in the JavaScript With special syntax, we can assign the value of a JavaScript variable to be the value of an E4X element

Creating XML Object

There are two ways of creating Objects

1. pass a string to the XML constructor

{`
var languages = new XML('<languages type="dynamic"><lang>JavaScript</lang><lang>Python</lang></languages>');
`}

2. embed the XML directly in your script, as an XML literal

{`
var languages = <languages type="dynamic">
<lang>JavaScript</lang>
<lang>Python</lang>
</languages>;
`}

On Web