13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Working with XML<br />

<br />

Questions, unanswered<br />

Steve and the flubberblubs<br />

1989<br />

<br />

<br />

What do you know?<br />

Steve and the flubberblubs<br />

2006-10-17-08:31<br />

<br />

<br />

Who do you know?<br />

Steve and the flubberblubs<br />

2006-10-17-08:35<br />

<br />

<br />

Wh<strong>en</strong> do you know?<br />

Steve and the flubberblubs<br />

2006-10-17-08:39<br />

<br />

<br />

Do you know?<br />

Steve and the flubberblubs<br />

2006-10-17-08:44<br />

<br />

<br />

<br />

Notice that this XML docum<strong>en</strong>t contains other complete XML structures within it (such as the song tags with their<br />

childr<strong>en</strong>). It also demonstrates other XML structures such as attributes (tracknumber and l<strong>en</strong>gth in the song tags),<br />

and tags that contain other tags rather than containing data (such as the tracks tag).<br />

Getting started with XML<br />

If you have little or no experi<strong>en</strong>ce with XML, here is a brief description of the most common aspects of XML data. XML<br />

data is writt<strong>en</strong> in plain-text form, with a specific syntax for organizing the information into a structured format.<br />

G<strong>en</strong>erally, a single set of XML data is known as an XML docum<strong>en</strong>t. In XML format, data is organized into elem<strong>en</strong>ts<br />

(which can be single data items or containers for other elem<strong>en</strong>ts) using a hierarchical structure. Every XML docum<strong>en</strong>t<br />

has a single elem<strong>en</strong>t as the top level or main item; inside this root elem<strong>en</strong>t there may be a single piece of information,<br />

although there are more likely to be other elem<strong>en</strong>ts, which in turn contain other elem<strong>en</strong>ts, and so forth. For example,<br />

this XML docum<strong>en</strong>t contains the information about a music album:<br />

<br />

What do you know?<br />

Steve and the flubberblubs<br />

Happy<br />

2006-10-17-08:31<br />

<br />

Each elem<strong>en</strong>t is distinguished by a set of tags—the elem<strong>en</strong>t’s name wrapped in angle brackets (less-than and greaterthan<br />

signs). The op<strong>en</strong>ing tag, indicating the start of the elem<strong>en</strong>t, has the elem<strong>en</strong>t name:<br />

<br />

The closing tag, which marks the <strong>en</strong>d of the elem<strong>en</strong>t, has a forward slash before the elem<strong>en</strong>t’s name:<br />

<br />

Last updated 6/6/2012<br />

96

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!