An XML document is simply a tree composed of a hierarchy of elements . In fact the document (exclusive of its optional prologue and extremely rare epilogue ) is a single XML element. Since an element includes its child elements, a thousand-element tree, if properly formed , is also a single element ”the one at the root.

Flash Context

An element appears in the Flash dataspace as a node. The root element appears as the only child element of the document. Each element has multiple pointers into the hierarchy: parent, siblings, and children. Each carries a list of the names and values of all its attributes. In sub-sequent chapters we become familiar with the precise arrangement of these data, and we become comfortable tracing and manipulating them.


An element is bracketed by a pair of tags. The information between these tags is the content of the element. The content can be nothing (it often is) or it can be a hideously complex and bulky data structure with hundreds of other complicated elements (it often is). Attribute information, if present, must be embedded in the start tag.The form of the element ID:

 <start tag>optional content</end tag> 

In the case of an empty element (which contains no content, though it has a name and may have attributes), the start tag and end tag are immediately consecutive and can be fused into a special symbol:

 <empty element tag/> 


Each element must have

  • a start tag, introducing its Name

  • an end tag (in some cases these two tags are fused)

Additionally, every element can contain any, all, or none of the following:

  • More elements

  • Text

  • Attributes

  • Entity references

  • Processing instructions

  • Comments

It may not have

  • XML declaration

  • document declaration

  • unterminated elements, references, comments, processor instructions

  • duplicate assignment of attribute

Examples of Elements
<Address>125 Main St</Address> Address element with street number as content
<Address>Fourscore... earth.</Address> Another address; it is up to the XML author
<Address line="city">N.Y.C.</Address> Element with content and attribute assignment
<Address>New York <b>City</b></Address> Element whose content includes another element
<Address line="apartment"/> Empty element with an attribute
<Address/> Empty element containing only a name token
Bad examples
<Address line="optional" line="zip"/> Multiple assignments of the same attribute
<Address>New York <br>City</Address> Incomplete inner element
<Address>New York <b>City</Address></b> Incomplete element: improper nesting

Flash and XML[c] A Developer[ap]s Guide
Flash and XML[c] A Developer[ap]s Guide
ISBN: 201729202
Year: 2005
Pages: 160

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net