This chapter starts the discussion on ActionScript 3.0 language features and Flex framework elements that are available to the modern Flex 3 developer for working with data. The items that will be covered are:
The Collections API
The Extensible Markup Language (XML) is a very prevalent means of describing, transferring, and storing data. If you create a Flex application via an MXML editor, you are using a custom declarative language that is based on XML. If you create an application that consumes a SOAP-based Web Service, you receive XML. If you create a configuration file to be distributed with your Flex application, there is a good chance that you will use XML.
For those of you new to XML, let's talk about how XML is constructed before proceeding. If you need to use XML, you have to keep in mind that it needs to be well formed. If the XML you are using is not well formed, the XML parser will choke, and either your application will not compile or it will throw runtime exceptions.
XML is composed of nodes in a hierarchical tree structure. This structure consists of exactly one root node and zero to many child nodes, or more specifically, zero to many XML elements. In the following example, the root node
<players/> has two immediate children, each an XML element of type
<?xml version="1.0" encoding="UTF-8"?> <players> <player> <category>battery</category> <position>pitcher</position> ...