- Flash Context
- Name
- Start Tag
- End Tag
- Attributes
- Text (Character Data)
- Entity References
- Comments
- Processor Instructions
- Conclusion
Text (Character Data)
Textor, more properly, character datais all the document content other than markup. (Markup is the XML codes: tags, comments, declarations, and so on.) The intent of the XML standard is that the significant content of the document is contained in the character data while the structure of the document is encoded in the markup. This intent is generally followed.
All character data is found within an XML element and forms the content of that element:
XML
<ELEMENT>Some text.</ELEMENT>
Elements are often found within text blocks. In this case, the outer element contains both character data and a child element:
XML
<ELEMENT>Some text.<CHILD/>More text</ELEMENT>
The embedded element breaks the character data into two distinct objects that applications can treat separately. When we study the Document Object Model, we will find these two blocks of text in separate nodes. There would then be three children of this elementtwo text nodes and one child element.
Of course, the child element might also have its own character data, which is not directly part of the outer element:
XML
<ELEMENT>Some text.<CHILD>Child's private text</CHILD>More text </ELEMENT>
Flash Context
Within ActionScript, each block of character data appears as an individual node. In the object model, these text nodes are as significant as element nodes. They are differentiated by NodeType and they must always be leaf nodes. Text that is interrupted by an element (as in the previous line of code) appears in memory as two separate text nodes plus the interrupting element (e.g., <CHILD>). This is especially problematic when the content contains even simple HTML markup. For example, it might include the common <u>underline</u> tag.
Syntax
Character data is any sequence of characters in the document's alphabet. The only disallowed characters are the two that introduce XML markup: the left angle bracket (<), which initiates all XML tags, and the ampersand (&), which initiates an entity. These two characters are inserted into character data with escape sequences.
Rules
Character data is composed of:
any character (including whitespace) except the < or &.
It may also include
escape sequences
other entity references
CDATA blocks
Examples of Character Data
<Team>Duluth Wildcats</Team> |
"Duluth Wildcats" is the content. |
<EQ>2*2<5</EQ> |
Content is "2*2 <5". |
<weather>El Niño</weather> |
Content is "El Niño". |
Bad Examples
<longdistance>AT&T</longdistance> |
Forbidden character |
<caption>The "<IMG>" tag</caption> |
Forbidden even within quotes |