Search for elements only while ignoring text nodes, comments, and processing directives, use elements() : Comments and Processing Instructions « XML « Flash / Flex / ActionScript






Search for elements only while ignoring text nodes, comments, and processing directives, use elements()

 


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

        var movieList:XML = <movieList>
                                <listName>My favorite movies</listName>
                                <movie id="123">
                                    <title>Titus</title>
                                    <year>1999</year>
                                    <director>J T</director>
                                </movie>
                                <movie id="456">
                                    <title>Rushmore</title>
                                    <year>1998</year>
                                    <director>W A</director>
                                </movie>
                                <movie id="789">
                                    <title>Hall</title>
                                    <year>1977</year>
                                    <director>Woody Allen</director>
                                </movie>
                           </movieList>;
        
        trace(movieList.elements("year"));

    }
  }
}

        








Related examples in the same category

1.Accessing Comments and Processing Instructions
2.To obtain an XMLList representing all comments and processing instructions within an entire XML tree
3.Finding Node Types: element, attribute, text, comment, processing-instruction
4.Converting Comments and Processing-Instructions to Strings
5.use the comments() method or the processingInstructions() method to get XMLLists
6.Setting Options for the XML Class