To access text nodes with the array-element access operator : text node « XML « Flash / Flex / ActionScript

Home
Flash / Flex / ActionScript
1.Animation
2.Array
3.Class
4.Data Type
5.Development
6.Function
7.Graphics
8.Language
9.Network
10.Regular Expressions
11.Statement
12.String
13.TextField
14.XML
Flash / Flex / ActionScript » XML » text node 
To access text nodes with the array-element access operator
 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){


        var novel:XML = <BOOK ISBN="0000000000">
            <TITLE>ActionScript</TITLE>
            <AUTHOR>J, J</AUTHOR>
            <PUBLISHER>Books Ltd</PUBLISHER>
        <DESCRIPTION>A <B>very</B> thick book.</DESCRIPTION>
          </BOOK>;
        
        trace(novel.DESCRIPTION.text(  )[0]);  // Displays: A
        trace(novel.DESCRIPTION.text(  )[1]);  // Displays: thick book.

    }
  }
}

        
Related examples in the same category
1.Use the properties wildcard
2.Access the content of a text node as a String, not an XML instance
3.Retrieve an XMLList with the two text nodes
4.To place the text nodes from each of those children into an XMLList
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.