O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Representing XML Data in E4X

In E4X, XML data is represented by one of two native ActionScript datatypes, XML and XMLList and their corresponding classes, also named XML and XMLList.

Warning

Due to the introduction of the E4X XML datatype, the legacy XML class from ActionScript 1.0 and ActionScript 2.0 has been renamed to XMLDocument in ActionScript 3.0 and moved to the flash.xml package.

Each XML instance represents one of the following five possible kinds of XML content, known as node kinds:

  • An element

  • An attribute

  • A text node

  • A comment

  • A processing instruction

If an XML element has any child elements (e.g., <BOOK>'s child <AUTHOR>) or child text nodes (e.g., <TITLE>'s child "Ulysses"), those children are wrapped in an XMLList by their parent XML instance. Each XMLList instance is an arbitrary collection of one or more XML instances. For example, an XMLList might be any of the following:

  • A series of attributes or elements returned by a search

  • A group of XML fragments, each with its own root element

  • A collection of the text nodes in a document

  • A collection of the comments in a document

  • A collection of the processing instructions in a document

The child nodes of an XML element are always wrapped in an XMLList. Even if an element has only one child (say, just a text node), that child is still wrapped in an XMLList. If an XML element has any attributes, comments, or processing instructions, those are likewise wrapped in an XMLList by the parent XML instance. However, comments and processing instructions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required