Text ”or, more properly, character data ”is 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 element ”two 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 ContextWithin 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. SyntaxCharacter 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. RulesCharacter data is composed of:
It may also include
Examples of Character Data
Bad Examples
|