Flash / AS

Blend / WPF
ASP.net / PHP

Photoshop

Forums
Blog

About

 


FlashComponents
  Galleries
  Slideshows
  Menus
  Design & Effects
  Audio & Video
  User Interface
  Templates

 

 

 

 


Introduction to XML in Flash
       by senocular

Text Nodes
Text nodes are what make up the bulk of your text, especially body text, in XML. Unlike elements, they themselves do not need an opening or closing tag, mainly because, well, they simply have no tags at all. They're just text. The previous example had three text nodes, Sandy, Peter, and I love you!

<letter>
<to>Sandy</to>
<from>Peter</from>
<body>I love you!</body>
</letter>

Though all single lined above, text nodes can span multiple lines and contain most types of text. However, because of the very form of XML and how it's structured using tags (with elements), there are certain characters in a text node that cannot be used or it will break the document formatting. If this happens, the document is said not to be well formed.

These certain characters will have to be replaced by character entity references. Strictly speaking only "<" and "&" are restricted (in their typical use and that can depend on the environment you're working in), though there are 5 predefined entity references for XML that you should be aware of. They are as follows:

Character Replace with
< &lt;
> &gt;
& &amp;
' &apos;
" &quot;

Example:

<incorrect>
It is clearly stated that variable A < variable B & variable A > variable C
</incorrect>
<acceptable>
It is clearly stated that variable A &lt; variable B &amp; variable A > variable C
</acceptable>

Notice that it was not completely necessary to replace the ">" character, only < and &, though it may be in your best interest to do so for good practice and consistency and, you know, just because it's the right thing to do.

<best>
It is clearly stated that variable A &lt; variable B &amp; variable A &gt; variable C
</best>

One thing that is easily forgotten is that text nodes are nodes - they are distinctly separate from element nodes and not a part of them. In fact, they are children of element nodes. Sandy is a child node of the to element and the to element is Sandy's parent. When getting into extracting content from XML, this is easily overlooked as, often, some elements' sole purpose is to contain a text node.


 


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components

Flash Templates
CSS Templates
Dreamweaver Templates

flash menus, buttons and components
Digicrafts Components The best flash components ever!
Entheos Flash Website Templates Free Flash Page Flip
flash components Buy and sell FLAs at Ultrashock!
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com create flash slideshow as easy as 1,2,3
Learn how to advertise on kirupa.com