O'Reilly logo

Learning ActionScript 3.0, 2nd Edition by Rich Shupe, Zevan Rosser

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

Chapter 14. XML

IN THIS CHAPTER

Understanding XML Structure

Creating an XML Object

Using Variables in XML

Reading XML

Writing XML

Deleting XML

Loading External XML Documents

Sending to and Loading from a Server

An XML-Based Navigation System

What’s Next?

XML, which stands for Extensible Markup Language, is a structured, text-based file format for storing and exchanging data. If you’ve seen HTML before, XML will look familiar. Like HTML, XML is a tag-based language. However, it was designed to organize data, rather than lay out a web page. Instead of a large collection of tags that define the language (as found in HTML), XML is wide open. It starts with only a handful of preexisting tags that serve very basic purposes. This freedom allows you to structure data in a way that’s most efficient for your needs.

In the past, traversing and working with XML within ActionScript has not been the most pleasant or efficient of experiences. Fortunately, E4X (which stands for ECMAScript for XML), is a part of ActionScript 3.0. E4X is the current standard for reading and writing XML documents and is maintained by the European Computer Manufacturers Association. It greatly reduces the amount of code and hoop-jumping required to communicate with XML. It allows you to treat XML objects like any other object with familiar dot syntax, and provides additional shortcuts for traversing XML data. You can use ActionScript’s E4X implementation to create XML inside a class or the Flash timeline or, more commonly, load ...

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