O'Reilly logo

ActionScript 3.0 Bible by Roger Braunstein

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 11. XML and E4X

FEATURED CLASSES

  • XML

  • XMLList

  • QName

  • Namespace

ActionScript 3.0 includes thorough, language-level support for XML. Not only can you create, load, and parse XML, you can write XML literals directly into ActionScript 3.0 code. A robust XML manipulation and query language, E4X, provides you with the tools to quickly and easily get the information you need. E4X, too, is implemented at the language level to make XML manipulation succinct.

Getting Started with XML in ActionScript

XML—the eXtensible Markup Language—is a format for storing any kind of hierarchical data. It has universal adoption and countless uses. XML is designed to be minimal; as the name extensible implies, you can design your own language that uses XML for its general structure but adds on more specific grammar.

XML References

This chapter 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 (http://www.w3schools.com/xml/), the Wikipedia entry on XML (http://en.wikipedia.org/wiki/XML), or one of the many books available on XML. Let's agree on some terminology:

<?xml version="1.0" encoding="UTF-8"?>
<parentNode>
  <childNode attributeName="Attribute Value">
    Node Content
  </childNode>
<childlessChildNode/>
  <!-- comment -->
</parentNode>

The XML document begins with the document declaration and contains exactly one root nodeparentNode here. Data is represented by nodes, or elementsparentNode and childNode—enclosed within ...

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