Sign in     
ECMAScript for XML

ECMAScript for XML (E4X) adds native XML support to ECMAScript, the international standard for JavaScript and one of the world's most widely used programming languages. Before E4X, reading, writing and maintaining XML code was tedious, time consuming and error prone requiring a heap of reference manuals and a technology stack large enough to throttle any small, mobile device.

E4X brings the power of simplicity back to XML. It flattens the XML learning curve by leveraging the existing skills and knowledge of the vast JavaScript developer community. It eliminates the need for heavy weight technologies like XSLT and the DOM, making E4X attractive for small, mobile devices with ever growing XML processing requirements. It also unlocks the flexible, dynamic nature of XML allowing more loosely coupled and change resilient solutions.

// Total all <item> elements and append the result to <order>
function appendTotal(order) {
  var totalPrice = 0;

  // Iterate over the <item> elements in <order>, calculating the total
  for each (item in order.item)
    totalPrice += item.price * item.quantity;

  // Append a new <total> element containing the total price to the <order>
  order.total = totalPrice;
}

With E4X, XML processing code is almost identical to JavaScript code

AgileDelta proposed the E4X initiative, led the development of the international E4X standard, authored the E4X specification and developed the first complete E4X implementation for our customer BEA Systems, Inc. We collaborated with leading browser, application server and mobile device vendors to develop the standard. We also worked closely with the Mozilla open source project to add E4X support to Mozilla Rhino 1.6. To learn more about E4X, check out the following resources:

E4X presentation Original proposal that kicked off the E4X initiative. Also available in PDF format.
E4X article BEA dev2dev article describing early E4X support in BEA's award winning Weblogic Workshop. You can download Weblogic Workshop for free.
E4X announcement ECMA announces agreement to pursue E4X with supporting quotes from BEA, Microsoft, Mozilla and RIM
E4X standard E4X standard and the complete E4X specification

E4X is being integrated into leading internet browsers, application servers and mobile devices. Contact us at products@agiledelta.com to add E4X support to your products!