Since Flash Player 5, ActionScript has included tools for working
with XML-structured data. In ActionScript 1.0 and ActionScript 2.0, XML
data was created and manipulated with the variables and methods of the
built-in XML class (e.g.,
nextSibling, appendChild( ), etc.). The XML class was based on the W3C Document
Object Model, or DOM, a standard for interacting with XML documents
programmatically (see http://www.w3.org/DOM).
Before we can learn to manipulate XML data with E4X, we must first understand the general principle of XML as hierarchical data. Both the legacy XML class and E4X treat XML data as a hierarchical tree in which each element and text block is considered a tree node (i.e., a branch or a leaf). For example, consider the XML fragment in Example 18-1. (An XML fragment is a section of XML excerpted from an XML document.)
Example 18-1. An example XML fragment
<BOOK ISBN="0141182806"> <TITLE>Ulysses</TITLE> <AUTHOR>Joyce, James</AUTHOR> <PUBLISHER>Penguin Books Ltd</PUBLISHER> </BOOK>
<AUTHOR>, and ...