Đang chuẩn bị liên kết để tải về tài liệu:
Adobe Flex 4 Training from the Source Volume 1 phần 4

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Điều này một lần nữa cho thấy E4X cho phép bạn sử dụng những ký hiệu quen thuộc để làm việc với XML. Trong các phiên bản trước đó của ActionScript, bạn phải sử dụng phương pháp cụ thể để truy cập dữ liệu trong XML. 7 Nhập category.product (đơn vị == "túi") và áp dụng các biểu thức. | Searching XML with E4X I 129 This again shows that E4X lets you use familiar notation to work with XML. In previous versions of ActionScript you had to use specific methods to access data in XML. 7 Enter category.product. unit bag and apply the expression. This limits the returned products to those whose unit node is bag. You ve limited the data returned by putting a filter in the expression. product name lettuce cost 1.95 unit bag unit desc Cleaned and bagged desc product The parentheses implement what is referred to as predicate filtering. 8 Enter category.product. @cost 1.95 and apply the expression. Two product nodes are returned. product name lettuce cost 1.95 unit bag unit desc Cleaned and bagged desc product product name apples cost 1.95 unit each unit desc Sweet Fuji desc product You have now performed predicate filtering on an attribute hence the use of the attribute operator @ in the parentheses @cost 1.95 . Also notice that if multiple nodes match the filter you simply get multiple nodes returned in this case both the lettuce and apples products. 9 Enter category.product. @cost 1.95 . unit each and apply the expression. This expression demonstrates that you can apply predicate filtering multiple times. This results in only one product being returned. product name apples cost 1.95 unit each unit desc Sweet Fuji desc product 10 Finally to see the berry products get involved enter category.product as the expression. You see that all products are returned regardless of where they are in the XML. product name lettuce cost 1.95 unit bag unit desc Cleaned and bagged desc product product name carrots cost 2.95 Download from www.eBookTM.com 130 I LESSON 6 Using Remote XML Data unit pound unit desc Baby carrots cleaned and peeled desc product product name apples cost 1.95 unit each unit desc Sweet Fuji desc product product name raspberries cost 3.95 unit pint unit desc Firm and fresh desc product product name strawberries cost 2.95 unit pint unit desc Deep red and