Example:

var novel:XML = <BOOK ISBN="0141182806>
<TITLE>Ulysses</TITLE>
<AUTHOR>Joyce, James</AUTHOR>
<PUBLISHER>Hi Books</PUBLISHER>
<DESCRIPTION>A <B>very</B> thick book.</DESCRIPTION>
</BOOK>;

novel.children() and novel.*
//Returns an XMLList representing 's child nodes

novel.children()[1]
//Reference to 's second child node

novel.child("AUTHOR") and novel.AUTHOR
//Returns all child elements of named "AUTHOR"

novel.AUTHOR[0].setName("WRITER")
//Change name of the first child element named "AUTHOR"

novel.TITLE.children()[0] and novel.TITLE.*[0]
//A reference to the text node Ulysses and not the string "Ulysses"

novel.TITLE.*[0].parent() //A reference to the <TITLE> element

novel.TITLE.*[0].nodeKind() //Returns the string "text"

novel.TITLE.*[0].toString() //Returns the string "Ulysses"

The <DESCRIPTION> element contains both element and text child nodes:

  • A (text node);
  • <B>very</B> (element node with a child text node);
  • thick book. (text node);

The text() method can also used to retrieve the text nodes from an entire XMLList, not just a single XML element.
trace(novel.DESCRIPTION.text()[0]); //Display: A

trace(novel.DESCRIPTION.text()[1]); //Display: thick book