Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 2720 Building Web Applications Flex ECMAScript for XML (E4X)

Similar presentations


Presentation on theme: "CSC 2720 Building Web Applications Flex ECMAScript for XML (E4X)"— Presentation transcript:

1 CSC 2720 Building Web Applications Flex ECMAScript for XML (E4X)

2  A programming language extension that adds native XML support to ECMAScript  Treats XML as a primitive type (instead of as an object)

3 public var employees:XML = 11 Main St. San Francisco CA Broad St. Newton MA ;

4 public var employees:XML = 11 Main St. San Francisco CA Broad St. Newton MA ;  employees.employee[0].address.zip or  employees.employee[0].address['zip']  1 st employee element  all address elements  all zip elements of each address element

5 public var employees:XML = 11 Main St. San Francisco CA Broad St. Newton MA ;  or   2 nd employee element  attribute ssn

6 public var employees:XML = 11 Main St. San Francisco CA Broad St. Newton MA ;  employees.employee.name  All employee elements  all name elements of each employee element

7 public var employees:XML = 11 Main St. San Francisco CA Broad St. Newton MA ;  employees..zip[0]  Root element  first zip element that is a descendent

8 public var employees:XML = 11 Main St. San Francisco CA Broad St. Newton MA ;   Root element  2 nd ssn attribute among the descendents

9 public var employees:XML = 11 Main St. San Francisco CA Broad St. Newton MA ;  employees.employee[0].address.*  1 st employee element  all address elements  all immediate child elements

10 public var employees:XML = 11 Main St. San Francisco CA Broad St. Newton MA ; var s:String = ''; for each (var num:XML in { s += (num) + " "; } // s becomes " "

11 public var employees:XML = 11 Main St. San Francisco CA Broad St. Newton MA ; var ssnToFind:String = " "; == ssnToFind).toXMLString() Select all employee elements  Retain only those with attribute ssn equals to " "  Get the XML representation of the selected elements

12

13 References and Resources  ActionScript 3.0 Language and Components Reference – XML   ActionScript 3.0 library for several basic utilities 


Download ppt "CSC 2720 Building Web Applications Flex ECMAScript for XML (E4X)"

Similar presentations


Ads by Google