Chapter 14. XML and E4X
XML, which stands for Extensible Markup Language, is a structured, text-based medium for exchanging data. XML is tag-based, like HTML, but is designed for organizing information rather than controlling visual display. Instead of a relatively large library of tags used to lay out pages and build interfaces, XML is wide open with only a handful of preexisting tags that are strictly for administrative purposes. This freedom allows you to structure data in a way that is most efficient for your needs.
E4X (ECMA for XML) is the current World Wide Web Consortium (WC3) standard for reading and writing XML documents, and 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 trees.
In this chapter you’ll learn the essentials of E4X. We’ll cover:
Understanding XML Structure. XML’s flexibility means you can set up files in a manner that best serves your project’s requirements. Unlike other tag-based languages, there’s no library of tags to memorize—just a few simple rules to follow.
Reading XML. Reading and parsing XML files is significantly easier using E4X than when using prior versions of ActionScript. You can find specific single pieces of information, as well as sweep through the entire document, using simple properties and methods that are consistent with other ActionScript objects.
Writing XML. You can ...
Get Learning ActionScript 3.0 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.