Chapter 19. XML
Flex 3 and ActionScript 3.0 provide ECMAScript for XML, or
E4X, implementation that enables you to work with dot
notation to access the nodes within an XML hierarchy. E4X provides a
simplified shorthand notation so you can access specific nodes or sets of
nodes by name or by index without complicated custom recursive functions.
It also defines methods and properties for accessing all parts of the XML
object, including comments, namespaces, and processing instructions. The
Flex Framework and ActionScript 3.0 define two low-level objects for
working with XML: the XML
object and
the XMLList
object. The XML
object represents a single XML element, an
XML document with multiple children, or a single-value element within a
document. The XMLList
object represents
a set of XML elements that are siblings of one another. XMLList
objects do not require a top-level node,
for example:
<item id="2" name="Chewing Gum"/> <item id="3" name="Cotton Candy"/> <item id="4" name="Candy Bar"/>
XML
objects do require a
top-level node:
<order> <item id="2" name="Chewing Gum"/> <item id="3" name="Cotton Candy"/> <item id="4" name="Candy Bar"/> </order>
To perform XML transformations or to build XML documents, both the
XML
and XMLList
objects define methods to append,
rename, and re-parent nodes within an XML document. To perform queries,
access particular attributes, or filter XML documents, use the E4X
querying syntax. For working with XML namespaces, the XMLUtil
class defines methods of accessing ...
Get Flex 3 Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.