Chapter 10. Working with XML
Introduction
In this chapter
Understanding XML and the new E4X system
Constructing XML objects using ActionScript
Accessing XML data using dot and at syntax
Filtering out the elements you need from an XML tree
Manipulating XML using built‐in methods
Working with namespaces, comments, and processing instructions
Perhaps one of the most significant changes to ActionScript in version 3.0 is the introduction of E4X, a completely reworked system for handling XML data based on the ECMAScript standard. This allows programmers to work seamlessly with XML in their programs. With ActionScript 3.0, XML data can be written directly into code using XML literals, which are parsed automatically.
Getting Started with XML in ActionScript
XML is a type of markup language for structuring data hierarchically that is widely used and has countless applications. This book assumes a basic knowledge of XML's structure and syntax. If you are unfamiliar with XML, you may want to check out the W3C Schools XML Tutorial (www.w3schools.com/xml/) or the Wikipedia entry on XML (http://en.wikipedia.org/wiki/XML).
Although XML comes in many different flavors, all XML shares this basic structure:
<parentNode> <childNode attributeName=”Attribute Value”> Node Content </childNode> </parentNode>
Data is contained within nodes, or elements, enclosed within start and end tags. Some elements contain attributes as name‐value pairs within their start tags, which contain additional information about the ...
Get ActionScript™ 3.0 Bible 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.