Loading ...
Sorry, an error occurred while loading the content.
 

E4X in Flex 2.0, part 1: Reading XML

Expand Messages
  • Gordon Smith
    As you may have gathered, we ve been spending a lot of time lately leveraging the new features of the Flash Player in the new Flex application model.
    Message 1 of 16 , May 17, 2005
      Message

      As you may have gathered, we've been spending a lot of time lately leveraging the new features of the Flash Player in the new Flex application model. Naturally, you'll also be able to leverage those same new features, so we thought we'd start giving you a run down of what's new. Of course we don't have beta software for you to play with yet, so for now, we'll provide a lot of detail so you can evaluate these new features and give guidance for us.

       

      XML manipulation in Flex 2.0 is going to get a lot more powerful, as well as faster. By the time that Flex 2.0 ships, the Flash Player will support E4X ("ECMAScript for XML"), a set of programming language extensions adding native XML support to ECMAScript. The player team is busy implementing Standard ECMA-357 as described in http://www.ecma-international.org/publications/standards/Ecma-357.htm.

       

      Here's how the spec describes what this feature offers: "E4X adds native XML datatypes to the ECMAScript language, extends the semantics of familiar ECMAScript operators for manipulating XML objects and adds a small set of new operators for common XML operations, such as searching and filtering. It also adds support for XML literals, namespaces, qualified names and other mechanisms to facilitate XML processing."

       

      Lets take a look at a few examples of how you can read XML data using E4X.

       

      As in the current player, you'll be able to create variables of type XML by parsing a String. But XML literals will now be supported as well:

       

          var employees:XML =
              <employees>
                  <employee ssn="123-123-1234">
                      <name first="John" last="Doe"/>
                      <address>
                          <street>11 Main St.</street>
                          <city>San Francisco</city>
                          <state>CA</state>
                          <zip>98765</zip>
                      </address>
                  </employee>
                  <employee ssn="789-789-7890">
                      <name first="Mary" last="Roe"/>
                      <address>
                          <street>99 Broad St.</street>
                          <city>Newton</city>
                          <state>MA</state>
                          <zip>01234</zip>
                      </address>
                  </employee>
              </employees>;

       

      Instead of using DOM-style APIs like firstChild, nextSibling, etc., with E4X you just "dot down" to grab the node you want. Multiple nodes are indexable with [n], similar to the elements of an Array:

       

          trace(employees.employee[0].address.zip);

          ---

          98765

       

      To grab an attribute, you just use the .@ operator:

       

          trace(employees.employee[1].@ssn);
          ---

          789-789-7890

       

      If you don't pick out a particular node, you get all of them, as an indexable list:

       

          trace(employees.employee.name);

          ---

          <name first="John" last="Doe"/>

          <name first="Mary" last="Roe"/>

       

      (And note that nodes even toString() themselves into formatted XML!)

       

      A handy double-dot operator lets you omit the "path" down into the XML expression, so you could shorten the previous three examples to

       

          trace(employees..zip[0]);

          trace(employees..@ssn[1]);

          trace(employees..name);

       

      You can use a * wildcard to get a list of multiple nodes or attributes with various names, and the resulting list is indexable:

       

          trace(employees.employee[0].address.*);

          ---

          <street>11 Main St.</street>

          <city>San Francisco</city>

          <state>CA</state>

          <zip>98765</zip>

          trace(employees.employee[0].name.@*[1]);
          ---

          Doe

       

      You don't have to hard-code the identifiers for the nodes or attributes... they can themselves be variables:

       

          var whichNode:String = "zip";
          trace(employees.employee[0].address[whichNode]);

          ---

          98765

       

          var whichAttribute:String = "ssn";
          trace(employees.employee[1].@[whichAttribute]);
          ---

          789-789-7890

       

      A new for-each loop lets you loop over multiple nodes or attributes:

       

          for each (var ssn:XML in employees..@ssn)

          {

              trace(ssn);

          }

          ---

          123-123-1234
          789-789-7890

       

      Most powerful of all, E4X supports "predicate filtering" using the syntax .(condition), which lets you pick out nodes or attributes that meet a condition you specify using a Boolean expression. For example, you can pick out the employee with a particular social security number like this, and get her state:

       

          var ssnToFind:String = "789-789-7890";
          trace(employees.employee.(@ssn == ssnToFind)..state);
          ---

          MA

       

      Instead of using a simple conditional operator like ==, you can also write a complicated predicate filtering function to pick out the data you need.

       

      By the way, although none of my examples use XML namespaces, E4X has complete support for them.

       

      Compared with the current XML support in the Flash Player, E4X allows you to write less code and execute it faster because more processing can be done at the native speed of C++.

       

      Since E4X is so powerful, we're working to make Flex 2.0 play nicely with it. Components like List, ComboBox, and DataGrid will be able to accept E4X expressions like employees..name as a dataProvider. The <mx:XML> tag will be able to declare an E4X-style XML object in MXML. WebService and HTTPService will be able to deliver E4X-style XML objects across the wire, and they'll use the speed of E4X to do their own work (such as constructing and desconstrucing SOAP packets) faster.

       

      For backward compability, the new player will continue to support the old-style XML and XMLNode objects, with the one change that the old XML class will be renamed to XMLDocument. The renaming is necessary because the E4X standard specifies that the new type be called XML. So if you have XML code and you want to continue using, just use XMLDocument instead. But we'll be encouraging everyone to migrate to E4X because it is so much simpler, faster, and more expressive.

       

      Please let us know whether you'll find E4X useful in your particular applications.

       

      - Gordon


       


       

       

    • Jeff Beeman
      This is very exciting! I m especially excited about the double-dot and wildcard operators. Thanks for this update, as it ll help with planning for future
      Message 2 of 16 , May 17, 2005
        Message

        This is very exciting!  I’m especially excited about the double-dot and wildcard operators.  Thanks for this update, as it’ll help with planning for future projects.  Keep ‘em coming!

         

         

        /******************************************
        * Jeff Beeman
        ******************************************/


        From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
        Sent: Tuesday, May 17, 2005 4:54 PM
        To: 'flexcoders@yahoogroups.com'
        Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML

         

        As you may have gathered, we've been spending a lot of time lately leveraging the new features of the Flash Player in the new Flex application model. Naturally, you'll also be able to leverage those same new features, so we thought we'd start giving you a run down of what's new. Of course we don't have beta software for you to play with yet, so for now, we'll provide a lot of detail so you can evaluate these new features and give guidance for us.

         

        XML manipulation in Flex 2.0 is going to get a lot more powerful, as well as faster. By the time that Flex 2.0 ships, the Flash Player will support E4X ("ECMAScript for XML"), a set of programming language extensions adding native XML support to ECMAScript. The player team is busy implementing Standard ECMA-357 as described in http://www.ecma-international.org/publications/standards/Ecma-357.htm.

         

        Here's how the spec describes what this feature offers: "E4X adds native XML datatypes to the ECMAScript language, extends the semantics of familiar ECMAScript operators for manipulating XML objects and adds a small set of new operators for common XML operations, such as searching and filtering. It also adds support for XML literals, namespaces, qualified names and other mechanisms to facilitate XML processing."

         

        Lets take a look at a few examples of how you can read XML data using E4X.

         

        As in the current player, you'll be able to create variables of type XML by parsing a String. But XML literals will now be supported as well:

         

            var employees:XML =
                <employees>
                    <employee ssn="123-123-1234">
                        <name first="John" last="Doe"/>
                        <address>
                            <street> 11 Main St. </street>
                            <city> San Francisco </city>
                            <state>CA</state>
                            <zip>98765</zip>
                        </address>
                    </employee>
                    <employee ssn="789-789-7890">
                        <name first="Mary" last="Roe"/>
                        <address>
                            <street>99 Broad St. </street>
                            <city> Newton </city>
                            <state>MA</state>
                            <zip>01234</zip>
                        </address>
                    </employee>
                </employees>;

         

        Instead of using DOM-style APIs like firstChild, nextSibling, etc., with E4X you just "dot down" to grab the node you want. Multiple nodes are indexable with [n], similar to the elements of an Array:

         

            trace(employees.employee[0].address.zip);

            ---

            98765

         

        To grab an attribute, you just use the .@ operator:

         

            trace(employees.employee[1].@ssn);
            ---

            789-789-7890

         

        If you don't pick out a particular node, you get all of them, as an indexable list:

         

            trace(employees.employee.name);

            ---

            <name first="John" last="Doe"/>

            <name first="Mary" last="Roe"/>

         

        (And note that nodes even toString() themselves into formatted XML!)

         

        A handy double-dot operator lets you omit the "path" down into the XML expression, so you could shorten the previous three examples to

         

            trace(employees..zip[0]);

            trace(employees..@ssn[1]);

            trace(employees..name);

         

        You can use a * wildcard to get a list of multiple nodes or attributes with various names, and the resulting list is indexable:

         

            trace(employees.employee[0].address.*);

            ---

            <street> 11 Main St. </street>

            <city> San Francisco </city>

            <state>CA</state>

            <zip>98765</zip>

            trace(employees.employee[0].name.@*[1]);
            ---

            Doe

         

        You don't have to hard-code the identifiers for the nodes or attributes... they can themselves be variables:

         

            var whichNode:String = "zip";
            trace(employees.employee[0].address[whichNode]);

            ---

            98765

         

            var whichAttribute:String = "ssn";
            trace(employees.employee[1].@[whichAttribute]);
            ---

            789-789-7890

         

        A new for-each loop lets you loop over multiple nodes or attributes:

         

            for each (var ssn:XML in employees..@ssn)

            {

                trace(ssn);

            }

            ---

            123-123-1234
            789-789-7890

         

        Most powerful of all, E4X supports "predicate filtering" using the syntax .(condition), which lets you pick out nodes or attributes that meet a condition you specify using a Boolean expression. For example, you can pick out the employee with a particular social security number like this, and get her state:

         

            var ssnToFind:String = "789-789-7890";
            trace(employees.employee.(@ssn == ssnToFind)..state);
            ---

            MA

         

        Instead of using a simple conditional operator like ==, you can also write a complicated predicate filtering function to pick out the data you need.

         

        By the way, although none of my examples use XML namespaces, E4X has complete support for them.

         

        Compared with the current XML support in the Flash Player, E4X allows you to write less code and execute it faster because more processing can be done at the native speed of C++.

         

        Since E4X is so powerful, we're working to make Flex 2.0 play nicely with it. Components like List, ComboBox, and DataGrid will be able to accept E4X expressions like employees..name as a dataProvider. The <mx:XML> tag will be able to declare an E4X-style XML object in MXML. WebService and HTTPService will be able to deliver E4X-style XML objects across the wire, and they'll use the speed of E4X to do their own work (such as constructing and desconstrucing SOAP packets) faster.

         

        For backward compability, the new player will continue to support the old-style XML and XMLNode objects, with the one change that the old XML class will be renamed to XMLDocument. The renaming is necessary because the E4X standard specifies that the new type be called XML. So if you have XML code and you want to continue using, just use XMLDocument instead. But we'll be encouraging everyone to migrate to E4X because it is so much simpler, faster, and more expressive.

         

        Please let us know whether you'll find E4X useful in your particular applications.

         

        - Gordon


         


         

         

         

      • JesterXL
        MessageThe ability to choose sub-nodes within an XML document vs. just the XML document itself for a is great since sometimes I d like to use the
        Message 3 of 16 , May 17, 2005
          Message
          The ability to choose sub-nodes within an XML document vs. just the XML document itself for a <mx:XML> is great since sometimes I'd like to use the contents of the same document in many places through Flex as a data provider.  The same way CSS styles help consildate my styles, XML helps consolidate my settings.
           
          So, if something like:
           
          <config>
           
            <soundsettings
                volume="50"
                pan="0" />
          </config>
           
          dataProvider={myXMLDocument.soundsettings}, whether that XMLNode has children, just a bunch of attributes, or is just a single node, that'd be great, and really helpful.
           
          ...of course, the whole:
           
          xmlDoc.soundsettings[0].@volume is just pathetically simple I almost feel guilty asking.
           
          ----- Original Message -----
          Sent: Tuesday, May 17, 2005 7:53 PM
          Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML

          As you may have gathered, we've been spending a lot of time lately leveraging the new features of the Flash Player in the new Flex application model. Naturally, you'll also be able to leverage those same new features, so we thought we'd start giving you a run down of what's new. Of course we don't have beta software for you to play with yet, so for now, we'll provide a lot of detail so you can evaluate these new features and give guidance for us.

           

          XML manipulation in Flex 2.0 is going to get a lot more powerful, as well as faster. By the time that Flex 2.0 ships, the Flash Player will support E4X ("ECMAScript for XML"), a set of programming language extensions adding native XML support to ECMAScript. The player team is busy implementing Standard ECMA-357 as described in http://www.ecma-international.org/publications/standards/Ecma-357.htm.

           

          Here's how the spec describes what this feature offers: "E4X adds native XML datatypes to the ECMAScript language, extends the semantics of familiar ECMAScript operators for manipulating XML objects and adds a small set of new operators for common XML operations, such as searching and filtering. It also adds support for XML literals, namespaces, qualified names and other mechanisms to facilitate XML processing."

           

          Lets take a look at a few examples of how you can read XML data using E4X.

           

          As in the current player, you'll be able to create variables of type XML by parsing a String. But XML literals will now be supported as well:

           

              var employees:XML =
                  <employees>
                      <employee ssn="123-123-1234">
                          <name first="John" last="Doe"/>
                          <address>
                              <street>11 Main St.</street>
                              <city>San Francisco</city>
                              <state>CA</state>
                              <zip>98765</zip>
                          </address>
                      </employee>
                      <employee ssn="789-789-7890">
                          <name first="Mary" last="Roe"/>
                          <address>
                              <street>99 Broad St.</street>
                              <city>Newton</city>
                              <state>MA</state>
                              <zip>01234</zip>
                          </address>
                      </employee>
                  </employees>;

           

          Instead of using DOM-style APIs like firstChild, nextSibling, etc., with E4X you just "dot down" to grab the node you want. Multiple nodes are indexable with [n], similar to the elements of an Array:

           

              trace(employees.employee[0].address.zip);

              ---

              98765

           

          To grab an attribute, you just use the .@ operator:

           

              trace(employees.employee[1].@ssn);
              ---

              789-789-7890

           

          If you don't pick out a particular node, you get all of them, as an indexable list:

           

              trace(employees.employee.name);

              ---

              <name first="John" last="Doe"/>

              <name first="Mary" last="Roe"/>

           

          (And note that nodes even toString() themselves into formatted XML!)

           

          A handy double-dot operator lets you omit the "path" down into the XML expression, so you could shorten the previous three examples to

           

              trace(employees..zip[0]);

              trace(employees..@ssn[1]);

              trace(employees..name);

           

          You can use a * wildcard to get a list of multiple nodes or attributes with various names, and the resulting list is indexable:

           

              trace(employees.employee[0].address.*);

              ---

              <street>11 Main St.</street>

              <city>San Francisco</city>

              <state>CA</state>

              <zip>98765</zip>

              trace(employees.employee[0].name.@*[1]);
              ---

              Doe

           

          You don't have to hard-code the identifiers for the nodes or attributes... they can themselves be variables:

           

              var whichNode:String = "zip";
              trace(employees.employee[0].address[whichNode]);

              ---

              98765

           

              var whichAttribute:String = "ssn";
              trace(employees.employee[1].@[whichAttribute]);
              ---

              789-789-7890

           

          A new for-each loop lets you loop over multiple nodes or attributes:

           

              for each (var ssn:XML in employees..@ssn)

              {

                  trace(ssn);

              }

              ---

              123-123-1234
              789-789-7890

           

          Most powerful of all, E4X supports "predicate filtering" using the syntax .(condition), which lets you pick out nodes or attributes that meet a condition you specify using a Boolean expression. For example, you can pick out the employee with a particular social security number like this, and get her state:

           

              var ssnToFind:String = "789-789-7890";
              trace(employees.employee.(@ssn == ssnToFind)..state);
              ---

              MA

           

          Instead of using a simple conditional operator like ==, you can also write a complicated predicate filtering function to pick out the data you need.

           

          By the way, although none of my examples use XML namespaces, E4X has complete support for them.

           

          Compared with the current XML support in the Flash Player, E4X allows you to write less code and execute it faster because more processing can be done at the native speed of C++.

           

          Since E4X is so powerful, we're working to make Flex 2.0 play nicely with it. Components like List, ComboBox, and DataGrid will be able to accept E4X expressions like employees..name as a dataProvider. The <mx:XML> tag will be able to declare an E4X-style XML object in MXML. WebService and HTTPService will be able to deliver E4X-style XML objects across the wire, and they'll use the speed of E4X to do their own work (such as constructing and desconstrucing SOAP packets) faster.

           

          For backward compability, the new player will continue to support the old-style XML and XMLNode objects, with the one change that the old XML class will be renamed to XMLDocument. The renaming is necessary because the E4X standard specifies that the new type be called XML. So if you have XML code and you want to continue using, just use XMLDocument instead. But we'll be encouraging everyone to migrate to E4X because it is so much simpler, faster, and more expressive.

           

          Please let us know whether you'll find E4X useful in your particular applications.

           

          - Gordon


           


           

           

        • Gordon Smith
          Oops... I meant to send this to an internal group, not to flexcoders. Enjoy the information, but, for now, don t expect this level of detail about our future
          Message 4 of 16 , May 17, 2005
            Message
            Oops... I meant to send this to an internal group, not to flexcoders. Enjoy the information, but, for now, don't expect this level of detail about our future plans. Of course, we do want your feedback on features for the next release, and we'll be sharing more plans with you in the future, as we get closer to the next release.
             
            Sorry,
            Gordon
            -----Original Message-----
            From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
            Sent: Tuesday, May 17, 2005 4:54 PM
            To: 'flexcoders@yahoogroups.com'
            Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML

            As you may have gathered, we've been spending a lot of time lately leveraging the new features of the Flash Player in the new Flex application model. Naturally, you'll also be able to leverage those same new features, so we thought we'd start giving you a run down of what's new. Of course we don't have beta software for you to play with yet, so for now, we'll provide a lot of detail so you can evaluate these new features and give guidance for us.

             

            XML manipulation in Flex 2.0 is going to get a lot more powerful, as well as faster. By the time that Flex 2.0 ships, the Flash Player will support E4X ("ECMAScript for XML"), a set of programming language extensions adding native XML support to ECMAScript. The player team is busy implementing Standard ECMA-357 as described in http://www.ecma-international.org/publications/standards/Ecma-357.htm.

             

            Here's how the spec describes what this feature offers: "E4X adds native XML datatypes to the ECMAScript language, extends the semantics of familiar ECMAScript operators for manipulating XML objects and adds a small set of new operators for common XML operations, such as searching and filtering. It also adds support for XML literals, namespaces, qualified names and other mechanisms to facilitate XML processing."

             

            Lets take a look at a few examples of how you can read XML data using E4X.

             

            As in the current player, you'll be able to create variables of type XML by parsing a String. But XML literals will now be supported as well:

             

                var employees:XML =
                    <employees>
                        <employee ssn="123-123-1234">
                            <name first="John" last="Doe"/>
                            <address>
                                <street>11 Main St.</street>
                                <city>San Francisco</city>
                                <state>CA</state>
                                <zip>98765</zip>
                            </address>
                        </employee>
                        <employee ssn="789-789-7890">
                            <name first="Mary" last="Roe"/>
                            <address>
                                <street>99 Broad St.</street>
                                <city>Newton</city>
                                <state>MA</state>
                                <zip>01234</zip>
                            </address>
                        </employee>
                    </employees>;

             

            Instead of using DOM-style APIs like firstChild, nextSibling, etc., with E4X you just "dot down" to grab the node you want. Multiple nodes are indexable with [n], similar to the elements of an Array:

             

                trace(employees.employee[0].address.zip);

                ---

                98765

             

            To grab an attribute, you just use the .@ operator:

             

                trace(employees.employee[1].@ssn);
                ---

                789-789-7890

             

            If you don't pick out a particular node, you get all of them, as an indexable list:

             

                trace(employees.employee.name);

                ---

                <name first="John" last="Doe"/>

                <name first="Mary" last="Roe"/>

             

            (And note that nodes even toString() themselves into formatted XML!)

             

            A handy double-dot operator lets you omit the "path" down into the XML expression, so you could shorten the previous three examples to

             

                trace(employees..zip[0]);

                trace(employees..@ssn[1]);

                trace(employees..name);

             

            You can use a * wildcard to get a list of multiple nodes or attributes with various names, and the resulting list is indexable:

             

                trace(employees.employee[0].address.*);

                ---

                <street>11 Main St.</street>

                <city>San Francisco</city>

                <state>CA</state>

                <zip>98765</zip>

                trace(employees.employee[0].name.@*[1]);
                ---

                Doe

             

            You don't have to hard-code the identifiers for the nodes or attributes... they can themselves be variables:

             

                var whichNode:String = "zip";
                trace(employees.employee[0].address[whichNode]);

                ---

                98765

             

                var whichAttribute:String = "ssn";
                trace(employees.employee[1].@[whichAttribute]);
                ---

                789-789-7890

             

            A new for-each loop lets you loop over multiple nodes or attributes:

             

                for each (var ssn:XML in employees..@ssn)

                {

                    trace(ssn);

                }

                ---

                123-123-1234
                789-789-7890

             

            Most powerful of all, E4X supports "predicate filtering" using the syntax .(condition), which lets you pick out nodes or attributes that meet a condition you specify using a Boolean expression. For example, you can pick out the employee with a particular social security number like this, and get her state:

             

                var ssnToFind:String = "789-789-7890";
                trace(employees.employee.(@ssn == ssnToFind)..state);
                ---

                MA

             

            Instead of using a simple conditional operator like ==, you can also write a complicated predicate filtering function to pick out the data you need.

             

            By the way, although none of my examples use XML namespaces, E4X has complete support for them.

             

            Compared with the current XML support in the Flash Player, E4X allows you to write less code and execute it faster because more processing can be done at the native speed of C++.

             

            Since E4X is so powerful, we're working to make Flex 2.0 play nicely with it. Components like List, ComboBox, and DataGrid will be able to accept E4X expressions like employees..name as a dataProvider. The <mx:XML> tag will be able to declare an E4X-style XML object in MXML. WebService and HTTPService will be able to deliver E4X-style XML objects across the wire, and they'll use the speed of E4X to do their own work (such as constructing and desconstrucing SOAP packets) faster.

             

            For backward compability, the new player will continue to support the old-style XML and XMLNode objects, with the one change that the old XML class will be renamed to XMLDocument. The renaming is necessary because the E4X standard specifies that the new type be called XML. So if you have XML code and you want to continue using, just use XMLDocument instead. But we'll be encouraging everyone to migrate to E4X because it is so much simpler, faster, and more expressive.

             

            Please let us know whether you'll find E4X useful in your particular applications.

             

            - Gordon


             


             

             

          • James Ward
            ROFL! Come on Gordon! If you are going to accidentally leak info, can you make it a bit juicier? ;) Maybe something about some super-secret project or the
            Message 5 of 16 , May 17, 2005
              ROFL! Come on Gordon! If you are going to accidentally leak info, can
              you make it a bit juicier? ;) Maybe something about some super-secret
              project or the Adobe buyout or Flex 2 release dates. This is good info,
              but not *that* exciting!

              Still laughing... :)

              -James


              On Tue, 2005-05-17 at 17:15 -0700, Gordon Smith wrote:
              > Oops... I meant to send this to an internal group, not to flexcoders.
              > Enjoy the information, but, for now, don't expect this level of detail
              > about our future plans. Of course, we do want your feedback on
              > features for the next release, and we'll be sharing more plans with
              > you in the future, as we get closer to the next release.
              >
              > Sorry,
              > Gordon
              > -----Original Message-----
              > From: flexcoders@yahoogroups.com
              > [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
              > Sent: Tuesday, May 17, 2005 4:54 PM
              > To: 'flexcoders@yahoogroups.com'
              > Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
              >
              >
              > As you may have gathered, we've been spending a lot of time
              > lately leveraging the new features of the Flash Player in the
              > new Flex application model. Naturally, you'll also be able to
              > leverage those same new features, so we thought we'd start
              > giving you a run down of what's new. Of course we don't have
              > beta software for you to play with yet, so for now, we'll
              > provide a lot of detail so you can evaluate these new features
              > and give guidance for us.
              >
              >
              >
              > XML manipulation in Flex 2.0 is going to get a lot more
              > powerful, as well as faster. By the time that Flex 2.0 ships,
              > the Flash Player will support E4X ("ECMAScript for XML"), a
              > set of programming language extensions adding native XML
              > support to ECMAScript. The player team is busy implementing
              > Standard ECMA-357 as described in
              > http://www.ecma-international.org/publications/standards/Ecma-357.htm.
              >
              >
              >
              >
              >
              > Here's how the spec describes what this feature offers: "E4X
              > adds native XML datatypes to the ECMAScript language, extends
              > the semantics of familiar ECMAScript operators for
              > manipulating XML objects and adds a small set of new operators
              > for common XML operations, such as searching and filtering. It
              > also adds support for XML literals, namespaces, qualified
              > names and other mechanisms to facilitate XML processing."
              >
              >
              >
              >
              >
              > Lets take a look at a few examples of how you can read XML
              > data using E4X.
              >
              >
              >
              >
              >
              > As in the current player, you'll be able to create variables
              > of type XML by parsing a String. But XML literals will now be
              > supported as well:
              >
              >
              >
              >
              >
              > var employees:XML =
              > <employees>
              > <employee ssn="123-123-1234">
              > <name first="John" last="Doe"/>
              > <address>
              > <street>11 Main St.</street>
              > <city>San Francisco</city>
              > <state>CA</state>
              > <zip>98765</zip>
              > </address>
              > </employee>
              > <employee ssn="789-789-7890">
              > <name first="Mary" last="Roe"/>
              > <address>
              > <street>99 Broad St.</street>
              > <city>Newton</city>
              > <state>MA</state>
              > <zip>01234</zip>
              > </address>
              > </employee>
              > </employees>;
              >
              >
              >
              >
              >
              > Instead of using DOM-style APIs like firstChild, nextSibling,
              > etc., with E4X you just "dot down" to grab the node you
              > want. Multiple nodes are indexable with [n], similar to the
              > elements of an Array:
              >
              >
              >
              >
              >
              > trace(employees.employee[0].address.zip);
              >
              >
              > ---
              >
              >
              > 98765
              >
              >
              >
              >
              >
              > To grab an attribute, you just use the .@ operator:
              >
              >
              >
              >
              >
              > trace(employees.employee[1].@ssn);
              > ---
              >
              >
              > 789-789-7890
              >
              >
              >
              >
              >
              > If you don't pick out a particular node, you get all of them,
              > as an indexable list:
              >
              >
              >
              >
              >
              > trace(employees.employee.name);
              >
              >
              > ---
              >
              >
              > <name first="John" last="Doe"/>
              >
              >
              > <name first="Mary" last="Roe"/>
              >
              >
              >
              >
              >
              > (And note that nodes even toString() themselves into formatted
              > XML!)
              >
              >
              >
              >
              >
              > A handy double-dot operator lets you omit the "path" down into
              > the XML expression, so you could shorten the previous three
              > examples to
              >
              >
              >
              >
              >
              > trace(employees..zip[0]);
              >
              >
              > trace(employees..@ssn[1]);
              >
              >
              > trace(employees..name);
              >
              >
              >
              >
              >
              > You can use a * wildcard to get a list of multiple nodes or
              > attributes with various names, and the resulting list is
              > indexable:
              >
              >
              >
              >
              >
              > trace(employees.employee[0].address.*);
              >
              >
              > ---
              >
              >
              > <street>11 Main St.</street>
              >
              >
              > <city>San Francisco</city>
              >
              >
              > <state>CA</state>
              >
              >
              > <zip>98765</zip>
              >
              >
              > trace(employees.employee[0].name.@*[1]);
              > ---
              >
              >
              > Doe
              >
              >
              >
              >
              >
              > You don't have to hard-code the identifiers for the nodes or
              > attributes... they can themselves be variables:
              >
              >
              >
              >
              >
              > var whichNode:String = "zip";
              > trace(employees.employee[0].address[whichNode]);
              >
              > ---
              >
              >
              > 98765
              >
              >
              >
              >
              >
              > var whichAttribute:String = "ssn";
              > trace(employees.employee[1].@[whichAttribute]);
              > ---
              >
              >
              > 789-789-7890
              >
              >
              >
              >
              >
              > A new for-each loop lets you loop over multiple nodes or
              > attributes:
              >
              >
              >
              >
              >
              > for each (var ssn:XML in employees..@ssn)
              >
              >
              > {
              >
              >
              > trace(ssn);
              >
              >
              > }
              >
              >
              > ---
              >
              >
              > 123-123-1234
              > 789-789-7890
              >
              >
              >
              >
              >
              > Most powerful of all, E4X supports "predicate filtering" using
              > the syntax .(condition), which lets you pick out nodes or
              > attributes that meet a condition you specify using a Boolean
              > expression. For example, you can pick out the employee with a
              > particular social security number like this, and get her
              > state:
              >
              >
              >
              >
              >
              > var ssnToFind:String = "789-789-7890";
              > trace(employees.employee.(@ssn == ssnToFind)..state);
              > ---
              >
              >
              > MA
              >
              >
              >
              >
              >
              > Instead of using a simple conditional operator like ==, you
              > can also write a complicated predicate filtering function to
              > pick out the data you need.
              >
              >
              >
              >
              >
              > By the way, although none of my examples use XML namespaces,
              > E4X has complete support for them.
              >
              >
              >
              >
              >
              > Compared with the current XML support in the Flash Player, E4X
              > allows you to write less code and execute it faster because
              > more processing can be done at the native speed of C++.
              >
              >
              >
              >
              >
              > Since E4X is so powerful, we're working to make Flex 2.0
              > play nicely with it. Components like List, ComboBox, and
              > DataGrid will be able to accept E4X expressions like
              > employees..name as a dataProvider. The <mx:XML> tag will be
              > able to declare an E4X-style XML object in MXML. WebService
              > and HTTPService will be able to deliver E4X-style XML objects
              > across the wire, and they'll use the speed of E4X to do their
              > own work (such as constructing and desconstrucing SOAP
              > packets) faster.
              >
              >
              >
              >
              >
              > For backward compability, the new player will continue to
              > support the old-style XML and XMLNode objects, with the one
              > change that the old XML class will be renamed to XMLDocument.
              > The renaming is necessary because the E4X standard specifies
              > that the new type be called XML. So if you have XML code and
              > you want to continue using, just use XMLDocument instead. But
              > we'll be encouraging everyone to migrate to E4X because it is
              > so much simpler, faster, and more expressive.
              >
              >
              >
              >
              >
              > Please let us know whether you'll find E4X useful in your
              > particular applications.
              >
              >
              >
              >
              >
              > - Gordon
              >
              >
              >
              >
              >
              >
              >
              >
              >
              >
              >
              >
              >
              >
              >
              > ______________________________________________________________
              > Yahoo! Groups Links
              > * To visit your group on the web, go to:
              > http://groups.yahoo.com/group/flexcoders/
              >
              > * To unsubscribe from this group, send an email to:
              > flexcoders-unsubscribe@yahoogroups.com
              >
              > * Your use of Yahoo! Groups is subject to the Yahoo!
              > Terms of Service.
              >
            • Gordon Smith
              OK, OK. Next time I ll try to leak something that will get me fired. Somebody on the list can give me a job as a Flex developer. - Gordon ... From:
              Message 6 of 16 , May 17, 2005
                OK, OK. Next time I'll try to leak something that will get me fired.
                Somebody on the list can give me a job as a Flex developer.

                - Gordon


                -----Original Message-----
                From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
                Behalf Of James Ward
                Sent: Tuesday, May 17, 2005 5:24 PM
                To: flexcoders@yahoogroups.com
                Subject: RE: [flexcoders] E4X in Flex 2.0, part 1: Reading XML


                ROFL! Come on Gordon! If you are going to accidentally leak info, can
                you make it a bit juicier? ;) Maybe something about some super-secret
                project or the Adobe buyout or Flex 2 release dates. This is good info,
                but not *that* exciting!

                Still laughing... :)

                -James


                On Tue, 2005-05-17 at 17:15 -0700, Gordon Smith wrote:
                > Oops... I meant to send this to an internal group, not to flexcoders.
                > Enjoy the information, but, for now, don't expect this level of detail
                > about our future plans. Of course, we do want your feedback on
                > features for the next release, and we'll be sharing more plans with
                > you in the future, as we get closer to the next release.
                >
                > Sorry,
                > Gordon
                > -----Original Message-----
                > From: flexcoders@yahoogroups.com
                > [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
                > Sent: Tuesday, May 17, 2005 4:54 PM
                > To: 'flexcoders@yahoogroups.com'
                > Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
                >
                >
                > As you may have gathered, we've been spending a lot of time
                > lately leveraging the new features of the Flash Player in the
                > new Flex application model. Naturally, you'll also be able to
                > leverage those same new features, so we thought we'd start
                > giving you a run down of what's new. Of course we don't have
                > beta software for you to play with yet, so for now, we'll
                > provide a lot of detail so you can evaluate these new features
                > and give guidance for us.
                >
                >
                >
                > XML manipulation in Flex 2.0 is going to get a lot more
                > powerful, as well as faster. By the time that Flex 2.0 ships,
                > the Flash Player will support E4X ("ECMAScript for XML"), a
                > set of programming language extensions adding native XML
                > support to ECMAScript. The player team is busy implementing
                > Standard ECMA-357 as described in
                >
                http://www.ecma-international.org/publications/standards/Ecma-357.htm.
                >
                >
                >
                >
                >
                > Here's how the spec describes what this feature offers: "E4X
                > adds native XML datatypes to the ECMAScript language, extends
                > the semantics of familiar ECMAScript operators for
                > manipulating XML objects and adds a small set of new operators
                > for common XML operations, such as searching and filtering. It
                > also adds support for XML literals, namespaces, qualified
                > names and other mechanisms to facilitate XML processing."
                >
                >
                >
                >
                >
                > Lets take a look at a few examples of how you can read XML
                > data using E4X.
                >
                >
                >
                >
                >
                > As in the current player, you'll be able to create variables
                > of type XML by parsing a String. But XML literals will now be
                > supported as well:
                >
                >
                >
                >
                >
                > var employees:XML =
                > <employees>
                > <employee ssn="123-123-1234">
                > <name first="John" last="Doe"/>
                > <address>
                > <street>11 Main St.</street>
                > <city>San Francisco</city>
                > <state>CA</state>
                > <zip>98765</zip>
                > </address>
                > </employee>
                > <employee ssn="789-789-7890">
                > <name first="Mary" last="Roe"/>
                > <address>
                > <street>99 Broad St.</street>
                > <city>Newton</city>
                > <state>MA</state>
                > <zip>01234</zip>
                > </address>
                > </employee>
                > </employees>;
                >
                >
                >
                >
                >
                > Instead of using DOM-style APIs like firstChild, nextSibling,
                > etc., with E4X you just "dot down" to grab the node you
                > want. Multiple nodes are indexable with [n], similar to the
                > elements of an Array:
                >
                >
                >
                >
                >
                > trace(employees.employee[0].address.zip);
                >
                >
                > ---
                >
                >
                > 98765
                >
                >
                >
                >
                >
                > To grab an attribute, you just use the .@ operator:
                >
                >
                >
                >
                >
                > trace(employees.employee[1].@ssn);
                > ---
                >
                >
                > 789-789-7890
                >
                >
                >
                >
                >
                > If you don't pick out a particular node, you get all of them,
                > as an indexable list:
                >
                >
                >
                >
                >
                > trace(employees.employee.name);
                >
                >
                > ---
                >
                >
                > <name first="John" last="Doe"/>
                >
                >
                > <name first="Mary" last="Roe"/>
                >
                >
                >
                >
                >
                > (And note that nodes even toString() themselves into formatted
                > XML!)
                >
                >
                >
                >
                >
                > A handy double-dot operator lets you omit the "path" down into
                > the XML expression, so you could shorten the previous three
                > examples to
                >
                >
                >
                >
                >
                > trace(employees..zip[0]);
                >
                >
                > trace(employees..@ssn[1]);
                >
                >
                > trace(employees..name);
                >
                >
                >
                >
                >
                > You can use a * wildcard to get a list of multiple nodes or
                > attributes with various names, and the resulting list is
                > indexable:
                >
                >
                >
                >
                >
                > trace(employees.employee[0].address.*);
                >
                >
                > ---
                >
                >
                > <street>11 Main St.</street>
                >
                >
                > <city>San Francisco</city>
                >
                >
                > <state>CA</state>
                >
                >
                > <zip>98765</zip>
                >
                >
                > trace(employees.employee[0].name.@*[1]);
                > ---
                >
                >
                > Doe
                >
                >
                >
                >
                >
                > You don't have to hard-code the identifiers for the nodes or
                > attributes... they can themselves be variables:
                >
                >
                >
                >
                >
                > var whichNode:String = "zip";
                > trace(employees.employee[0].address[whichNode]);
                >
                > ---
                >
                >
                > 98765
                >
                >
                >
                >
                >
                > var whichAttribute:String = "ssn";
                > trace(employees.employee[1].@[whichAttribute]);
                > ---
                >
                >
                > 789-789-7890
                >
                >
                >
                >
                >
                > A new for-each loop lets you loop over multiple nodes or
                > attributes:
                >
                >
                >
                >
                >
                > for each (var ssn:XML in employees..@ssn)
                >
                >
                > {
                >
                >
                > trace(ssn);
                >
                >
                > }
                >
                >
                > ---
                >
                >
                > 123-123-1234
                > 789-789-7890
                >
                >
                >
                >
                >
                > Most powerful of all, E4X supports "predicate filtering" using
                > the syntax .(condition), which lets you pick out nodes or
                > attributes that meet a condition you specify using a Boolean
                > expression. For example, you can pick out the employee with a
                > particular social security number like this, and get her
                > state:
                >
                >
                >
                >
                >
                > var ssnToFind:String = "789-789-7890";
                > trace(employees.employee.(@ssn == ssnToFind)..state);
                > ---
                >
                >
                > MA
                >
                >
                >
                >
                >
                > Instead of using a simple conditional operator like ==, you
                > can also write a complicated predicate filtering function to
                > pick out the data you need.
                >
                >
                >
                >
                >
                > By the way, although none of my examples use XML namespaces,
                > E4X has complete support for them.
                >
                >
                >
                >
                >
                > Compared with the current XML support in the Flash Player, E4X
                > allows you to write less code and execute it faster because
                > more processing can be done at the native speed of C++.
                >
                >
                >
                >
                >
                > Since E4X is so powerful, we're working to make Flex 2.0
                > play nicely with it. Components like List, ComboBox, and
                > DataGrid will be able to accept E4X expressions like
                > employees..name as a dataProvider. The <mx:XML> tag will be
                > able to declare an E4X-style XML object in MXML. WebService
                > and HTTPService will be able to deliver E4X-style XML objects
                > across the wire, and they'll use the speed of E4X to do their
                > own work (such as constructing and desconstrucing SOAP
                > packets) faster.
                >
                >
                >
                >
                >
                > For backward compability, the new player will continue to
                > support the old-style XML and XMLNode objects, with the one
                > change that the old XML class will be renamed to XMLDocument.
                > The renaming is necessary because the E4X standard specifies
                > that the new type be called XML. So if you have XML code and
                > you want to continue using, just use XMLDocument instead. But
                > we'll be encouraging everyone to migrate to E4X because it is
                > so much simpler, faster, and more expressive.
                >
                >
                >
                >
                >
                > Please let us know whether you'll find E4X useful in your
                > particular applications.
                >
                >
                >
                >
                >
                > - Gordon
                >
                >
                >
                >
                >
                >
                >
                >
                >
                >
                >
                >
                >
                >
                >
                > ______________________________________________________________
                > Yahoo! Groups Links
                > * To visit your group on the web, go to:
                > http://groups.yahoo.com/group/flexcoders/
                >
                > * To unsubscribe from this group, send an email to:
                > flexcoders-unsubscribe@yahoogroups.com
                >
                > * Your use of Yahoo! Groups is subject to the Yahoo!
                > Terms of Service.
                >





                Yahoo! Groups Links
              • Hans Omli
                I don t suppose we ll be reading part 2 of this email via FlexCoders then. ;-) _____ From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
                Message 7 of 16 , May 17, 2005
                  Message
                  I don't suppose we'll be reading part 2 of this email via FlexCoders then.  ;-)


                  From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
                  Sent: Tuesday, May 17, 2005 5:15 PM
                  To: 'flexcoders@yahoogroups.com'
                  Subject: RE: [flexcoders] E4X in Flex 2.0, part 1: Reading XML

                  Oops... I meant to send this to an internal group, not to flexcoders. Enjoy the information, but, for now, don't expect this level of detail about our future plans. Of course, we do want your feedback on features for the next release, and we'll be sharing more plans with you in the future, as we get closer to the next release.
                   
                  Sorry,
                  Gordon
                  -----Original Message-----
                  From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
                  Sent: Tuesday, May 17, 2005 4:54 PM
                  To: 'flexcoders@yahoogroups.com'
                  Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML

                  As you may have gathered, we've been spending a lot of time lately leveraging the new features of the Flash Player in the new Flex application model. Naturally, you'll also be able to leverage those same new features, so we thought we'd start giving you a run down of what's new. Of course we don't have beta software for you to play with yet, so for now, we'll provide a lot of detail so you can evaluate these new features and give guidance for us.

                   

                  XML manipulation in Flex 2.0 is going to get a lot more powerful, as well as faster. By the time that Flex 2.0 ships, the Flash Player will support E4X ("ECMAScript for XML"), a set of programming language extensions adding native XML support to ECMAScript. The player team is busy implementing Standard ECMA-357 as described in http://www.ecma-international.org/publications/standards/Ecma-357.htm.

                   

                  Here's how the spec describes what this feature offers: "E4X adds native XML datatypes to the ECMAScript language, extends the semantics of familiar ECMAScript operators for manipulating XML objects and adds a small set of new operators for common XML operations, such as searching and filtering. It also adds support for XML literals, namespaces, qualified names and other mechanisms to facilitate XML processing."

                   

                  Lets take a look at a few examples of how you can read XML data using E4X.

                   

                  As in the current player, you'll be able to create variables of type XML by parsing a String. But XML literals will now be supported as well:

                   

                      var employees:XML =
                          <employees>
                              <employee ssn="123-123-1234">
                                  <name first="John" last="Doe"/>
                                  <address>
                                      <street>11 Main St.</street>
                                      <city>San Francisco</city>
                                      <state>CA</state>
                                      <zip>98765</zip>
                                  </address>
                              </employee>
                              <employee ssn="789-789-7890">
                                  <name first="Mary" last="Roe"/>
                                  <address>
                                      <street>99 Broad St.</street>
                                      <city>Newton</city>
                                      <state>MA</state>
                                      <zip>01234</zip>
                                  </address>
                              </employee>
                          </employees>;

                   

                  Instead of using DOM-style APIs like firstChild, nextSibling, etc., with E4X you just "dot down" to grab the node you want. Multiple nodes are indexable with [n], similar to the elements of an Array:

                   

                      trace(employees.employee[0].address.zip);

                      ---

                      98765

                   

                  To grab an attribute, you just use the .@ operator:

                   

                      trace(employees.employee[1].@ssn);
                      ---

                      789-789-7890

                   

                  If you don't pick out a particular node, you get all of them, as an indexable list:

                   

                      trace(employees.employee.name);

                      ---

                      <name first="John" last="Doe"/>

                      <name first="Mary" last="Roe"/>

                   

                  (And note that nodes even toString() themselves into formatted XML!)

                   

                  A handy double-dot operator lets you omit the "path" down into the XML expression, so you could shorten the previous three examples to

                   

                      trace(employees..zip[0]);

                      trace(employees..@ssn[1]);

                      trace(employees..name);

                   

                  You can use a * wildcard to get a list of multiple nodes or attributes with various names, and the resulting list is indexable:

                   

                      trace(employees.employee[0].address.*);

                      ---

                      <street>11 Main St.</street>

                      <city>San Francisco</city>

                      <state>CA</state>

                      <zip>98765</zip>

                      trace(employees.employee[0].name.@*[1]);
                      ---

                      Doe

                   

                  You don't have to hard-code the identifiers for the nodes or attributes... they can themselves be variables:

                   

                      var whichNode:String = "zip";
                      trace(employees.employee[0].address[whichNode]);

                      ---

                      98765

                   

                      var whichAttribute:String = "ssn";
                      trace(employees.employee[1].@[whichAttribute]);
                      ---

                      789-789-7890

                   

                  A new for-each loop lets you loop over multiple nodes or attributes:

                   

                      for each (var ssn:XML in employees..@ssn)

                      {

                          trace(ssn);

                      }

                      ---

                      123-123-1234
                      789-789-7890

                   

                  Most powerful of all, E4X supports "predicate filtering" using the syntax .(condition), which lets you pick out nodes or attributes that meet a condition you specify using a Boolean expression. For example, you can pick out the employee with a particular social security number like this, and get her state:

                   

                      var ssnToFind:String = "789-789-7890";
                      trace(employees.employee.(@ssn == ssnToFind)..state);
                      ---

                      MA

                   

                  Instead of using a simple conditional operator like ==, you can also write a complicated predicate filtering function to pick out the data you need.

                   

                  By the way, although none of my examples use XML namespaces, E4X has complete support for them.

                   

                  Compared with the current XML support in the Flash Player, E4X allows you to write less code and execute it faster because more processing can be done at the native speed of C++.

                   

                  Since E4X is so powerful, we're working to make Flex 2.0 play nicely with it. Components like List, ComboBox, and DataGrid will be able to accept E4X expressions like employees..name as a dataProvider. The <mx:XML> tag will be able to declare an E4X-style XML object in MXML. WebService and HTTPService will be able to deliver E4X-style XML objects across the wire, and they'll use the speed of E4X to do their own work (such as constructing and desconstrucing SOAP packets) faster.

                   

                  For backward compability, the new player will continue to support the old-style XML and XMLNode objects, with the one change that the old XML class will be renamed to XMLDocument. The renaming is necessary because the E4X standard specifies that the new type be called XML. So if you have XML code and you want to continue using, just use XMLDocument instead. But we'll be encouraging everyone to migrate to E4X because it is so much simpler, faster, and more expressive.

                   

                  Please let us know whether you'll find E4X useful in your particular applications.

                   

                  - Gordon


                   


                   

                   

                • Jeff Steiner
                  That is flat out increadible. I can t wait! Jeff http://www.flexauthority.com ... From: Jeff Beeman To:
                  Message 8 of 16 , May 17, 2005
                    That is flat out increadible.

                    I can't wait!

                    Jeff
                    http://www.flexauthority.com

                    ----- Original Message -----
                    From: "Jeff Beeman" <jeffrey.beeman@...>
                    To: <flexcoders@yahoogroups.com>
                    Sent: Tuesday, May 17, 2005 5:04 PM
                    Subject: RE: [flexcoders] E4X in Flex 2.0, part 1: Reading XML


                    This is very exciting! I'm especially excited about the double-dot and
                    wildcard operators. Thanks for this update, as it'll help with planning
                    for future projects. Keep 'em coming!





                    /******************************************
                    * Jeff Beeman
                    ******************************************/

                    _____

                    From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
                    Behalf Of Gordon Smith
                    Sent: Tuesday, May 17, 2005 4:54 PM
                    To: 'flexcoders@yahoogroups.com'
                    Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML



                    As you may have gathered, we've been spending a lot of time lately
                    leveraging the new features of the Flash Player in the new Flex
                    application model. Naturally, you'll also be able to leverage those same
                    new features, so we thought we'd start giving you a run down of what's
                    new. Of course we don't have beta software for you to play with yet, so
                    for now, we'll provide a lot of detail so you can evaluate these new
                    features and give guidance for us.



                    XML manipulation in Flex 2.0 is going to get a lot more powerful, as
                    well as faster. By the time that Flex 2.0 ships, the Flash Player will
                    support E4X ("ECMAScript for XML"), a set of programming language
                    extensions adding native XML support to ECMAScript. The player team is
                    busy implementing Standard ECMA-357 as described in
                    http://www.ecma-international.org/publications/standards/Ecma-357.htm.



                    Here's how the spec describes what this feature offers: "E4X adds native
                    XML datatypes to the ECMAScript language, extends the semantics of
                    familiar ECMAScript operators for manipulating XML objects and adds a
                    small set of new operators for common XML operations, such as searching
                    and filtering. It also adds support for XML literals, namespaces,
                    qualified names and other mechanisms to facilitate XML processing."



                    Lets take a look at a few examples of how you can read XML data using
                    E4X.



                    As in the current player, you'll be able to create variables of type XML
                    by parsing a String. But XML literals will now be supported as well:



                    var employees:XML =
                    <employees>
                    <employee ssn="123-123-1234">
                    <name first="John" last="Doe"/>
                    <address>
                    <street>11 Main St.</street>
                    <city>San Francisco</city>
                    <state>CA</state>
                    <zip>98765</zip>
                    </address>
                    </employee>
                    <employee ssn="789-789-7890">
                    <name first="Mary" last="Roe"/>
                    <address>
                    <street>99 Broad St.</street>
                    <city>Newton</city>
                    <state>MA</state>
                    <zip>01234</zip>
                    </address>
                    </employee>
                    </employees>;



                    Instead of using DOM-style APIs like firstChild, nextSibling, etc., with
                    E4X you just "dot down" to grab the node you want. Multiple nodes are
                    indexable with [n], similar to the elements of an Array:



                    trace(employees.employee[0].address.zip);

                    ---

                    98765



                    To grab an attribute, you just use the .@ operator:



                    trace(employees.employee[1].@ssn);
                    ---

                    789-789-7890



                    If you don't pick out a particular node, you get all of them, as an
                    indexable list:



                    trace(employees.employee.name);

                    ---

                    <name first="John" last="Doe"/>

                    <name first="Mary" last="Roe"/>



                    (And note that nodes even toString() themselves into formatted XML!)



                    A handy double-dot operator lets you omit the "path" down into the XML
                    expression, so you could shorten the previous three examples to



                    trace(employees..zip[0]);

                    trace(employees..@ssn[1 <mailto:employees..@ssn%5b1> ]);

                    trace(employees..name);



                    You can use a * wildcard to get a list of multiple nodes or attributes
                    with various names, and the resulting list is indexable:



                    trace(employees.employee[0].address.*);

                    ---

                    <street>11 Main St.</street>

                    <city>San Francisco</city>

                    <state>CA</state>

                    <zip>98765</zip>

                    trace(employees.employee[0].name.@*[1]);
                    ---

                    Doe



                    You don't have to hard-code the identifiers for the nodes or
                    attributes... they can themselves be variables:



                    var whichNode:String = "zip";
                    trace(employees.employee[0].address[whichNode]);

                    ---

                    98765



                    var whichAttribute:String = "ssn";
                    trace(employees.employee[1].@[whichAttribute]);
                    ---

                    789-789-7890



                    A new for-each loop lets you loop over multiple nodes or attributes:



                    for each (var ssn:XML in employees..@ssn <mailto:employees..@ssn> )

                    {

                    trace(ssn);

                    }

                    ---

                    123-123-1234
                    789-789-7890



                    Most powerful of all, E4X supports "predicate filtering" using the
                    syntax .(condition), which lets you pick out nodes or attributes that
                    meet a condition you specify using a Boolean expression. For example,
                    you can pick out the employee with a particular social security number
                    like this, and get her state:



                    var ssnToFind:String = "789-789-7890";
                    trace(employees.employee.(@ssn == ssnToFind)..state);
                    ---

                    MA



                    Instead of using a simple conditional operator like ==, you can also
                    write a complicated predicate filtering function to pick out the data
                    you need.



                    By the way, although none of my examples use XML namespaces, E4X has
                    complete support for them.



                    Compared with the current XML support in the Flash Player, E4X allows
                    you to write less code and execute it faster because more processing can
                    be done at the native speed of C++.



                    Since E4X is so powerful, we're working to make Flex 2.0 play nicely
                    with it. Components like List, ComboBox, and DataGrid will be able to
                    accept E4X expressions like employees..name as a dataProvider. The
                    <mx:XML> tag will be able to declare an E4X-style XML object in MXML.
                    WebService and HTTPService will be able to deliver E4X-style XML objects
                    across the wire, and they'll use the speed of E4X to do their own work
                    (such as constructing and desconstrucing SOAP packets) faster.



                    For backward compability, the new player will continue to support the
                    old-style XML and XMLNode objects, with the one change that the old XML
                    class will be renamed to XMLDocument. The renaming is necessary because
                    the E4X standard specifies that the new type be called XML. So if you
                    have XML code and you want to continue using, just use XMLDocument
                    instead. But we'll be encouraging everyone to migrate to E4X because it
                    is so much simpler, faster, and more expressive.



                    Please let us know whether you'll find E4X useful in your particular
                    applications.



                    - Gordon











                    _____

                    Yahoo! Groups Links

                    * To visit your group on the web, go to:
                    http://groups.yahoo.com/group/flexcoders/

                    * To unsubscribe from this group, send an email to:
                    flexcoders-unsubscribe@yahoogroups.com
                    <mailto:flexcoders-unsubscribe@yahoogroups.com?subject=Unsubscribe>

                    * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                    Service <http://docs.yahoo.com/info/terms/> .
                  • Scott Barnes
                    heheheheheheh thats funny. I had to do a double take and thought am i reading the right list here or... Nice work ;) ... -- Regards, Scott Barnes
                    Message 9 of 16 , May 17, 2005
                      heheheheheheh thats funny.

                      I had to do a double take and thought "am i reading the right list here or..."

                      Nice work ;)


                      On 5/18/05, Hans Omli <hansomli@...> wrote:
                      >
                      > I don't suppose we'll be reading part 2 of this email via FlexCoders then.
                      > ;-)
                      >
                      > ________________________________
                      > From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
                      > Behalf Of Gordon Smith
                      > Sent: Tuesday, May 17, 2005 5:15 PM
                      > To: 'flexcoders@yahoogroups.com'
                      > Subject: RE: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
                      >
                      >
                      >
                      > Oops... I meant to send this to an internal group, not to flexcoders. Enjoy
                      > the information, but, for now, don't expect this level of detail about our
                      > future plans. Of course, we do want your feedback on features for the next
                      > release, and we'll be sharing more plans with you in the future, as we get
                      > closer to the next release.
                      >
                      > Sorry,
                      > Gordon
                      >
                      >
                      > -----Original Message-----
                      > From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
                      > Behalf Of Gordon Smith
                      > Sent: Tuesday, May 17, 2005 4:54 PM
                      > To: 'flexcoders@yahoogroups.com'
                      > Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
                      >
                      >
                      >
                      >
                      >
                      > As you may have gathered, we've been spending a lot of time lately
                      > leveraging the new features of the Flash Player in the new Flex application
                      > model. Naturally, you'll also be able to leverage those same new features,
                      > so we thought we'd start giving you a run down of what's new. Of course we
                      > don't have beta software for you to play with yet, so for now, we'll provide
                      > a lot of detail so you can evaluate these new features and give guidance for
                      > us.
                      >
                      >
                      >
                      > XML manipulation in Flex 2.0 is going to get a lot more powerful, as well as
                      > faster. By the time that Flex 2.0 ships, the Flash Player will support E4X
                      > ("ECMAScript for XML"), a set of programming language extensions adding
                      > native XML support to ECMAScript. The player team is busy implementing
                      > Standard ECMA-357 as described in
                      > http://www.ecma-international.org/publications/standards/Ecma-357.htm.
                      >
                      >
                      >
                      >
                      >
                      > Here's how the spec describes what this feature offers: "E4X adds native XML
                      > datatypes to the ECMAScript language, extends the semantics of familiar
                      > ECMAScript operators for manipulating XML objects and adds a small set of
                      > new operators for common XML operations, such as searching and filtering. It
                      > also adds support for XML literals, namespaces, qualified names and other
                      > mechanisms to facilitate XML processing."
                      >
                      >
                      >
                      >
                      >
                      > Lets take a look at a few examples of how you can read XML data using E4X.
                      >
                      >
                      >
                      >
                      >
                      > As in the current player, you'll be able to create variables of type XML by
                      > parsing a String. But XML literals will now be supported as well:
                      >
                      >
                      >
                      >
                      >
                      > var employees:XML =
                      > <employees>
                      > <employee ssn="123-123-1234">
                      > <name first="John" last="Doe"/>
                      > <address>
                      > <street>11 Main St.</street>
                      > <city>San Francisco</city>
                      > <state>CA</state>
                      > <zip>98765</zip>
                      > </address>
                      > </employee>
                      > <employee ssn="789-789-7890">
                      > <name first="Mary" last="Roe"/>
                      > <address>
                      > <street>99 Broad St.</street>
                      > <city>Newton</city>
                      > <state>MA</state>
                      > <zip>01234</zip>
                      > </address>
                      > </employee>
                      > </employees>;
                      >
                      >
                      >
                      >
                      >
                      > Instead of using DOM-style APIs like firstChild, nextSibling, etc., with E4X
                      > you just "dot down" to grab the node you want. Multiple nodes are indexable
                      > with [n], similar to the elements of an Array:
                      >
                      >
                      >
                      >
                      >
                      > trace(employees.employee[0].address.zip);
                      >
                      >
                      > ---
                      >
                      >
                      > 98765
                      >
                      >
                      >
                      >
                      >
                      > To grab an attribute, you just use the .@ operator:
                      >
                      >
                      >
                      >
                      >
                      > trace(employees.employee[1].@ssn);
                      > ---
                      >
                      >
                      >
                      > 789-789-7890
                      >
                      >
                      >
                      >
                      >
                      > If you don't pick out a particular node, you get all of them, as an
                      > indexable list:
                      >
                      >
                      >
                      >
                      >
                      > trace(employees.employee.name);
                      >
                      >
                      > ---
                      >
                      >
                      > <name first="John" last="Doe"/>
                      >
                      >
                      > <name first="Mary" last="Roe"/>
                      >
                      >
                      >
                      >
                      >
                      > (And note that nodes even toString() themselves into formatted XML!)
                      >
                      >
                      >
                      >
                      >
                      >
                      > A handy double-dot operator lets you omit the "path" down into the XML
                      > expression, so you could shorten the previous three examples to
                      >
                      >
                      >
                      >
                      >
                      > trace(employees..zip[0]);
                      >
                      >
                      >
                      > trace(employees..@ssn[1]);
                      >
                      >
                      >
                      > trace(employees..name);
                      >
                      >
                      >
                      >
                      > You can use a * wildcard to get a list of multiple nodes or attributes with
                      > various names, and the resulting list is indexable:
                      >
                      >
                      >
                      >
                      >
                      > trace(employees.employee[0].address.*);
                      >
                      >
                      > ---
                      >
                      >
                      > <street>11 Main St.</street>
                      >
                      >
                      > <city>San Francisco</city>
                      >
                      >
                      > <state>CA</state>
                      >
                      >
                      > <zip>98765</zip>
                      >
                      >
                      > trace(employees.employee[0].name.@*[1]);
                      > ---
                      >
                      >
                      > Doe
                      >
                      >
                      >
                      >
                      >
                      > You don't have to hard-code the identifiers for the nodes or attributes...
                      > they can themselves be variables:
                      >
                      >
                      >
                      >
                      >
                      >
                      >
                      > var whichNode:String = "zip";
                      > trace(employees.employee[0].address[whichNode]);
                      >
                      >
                      > ---
                      >
                      >
                      > 98765
                      >
                      >
                      >
                      >
                      >
                      >
                      > var whichAttribute:String = "ssn";
                      > trace(employees.employee[1].@[whichAttribute]);
                      > ---
                      >
                      >
                      > 789-789-7890
                      >
                      >
                      >
                      >
                      >
                      > A new for-each loop lets you loop over multiple nodes or attributes:
                      >
                      >
                      >
                      >
                      >
                      > for each (var ssn:XML in employees..@ssn)
                      >
                      >
                      > {
                      >
                      >
                      > trace(ssn);
                      >
                      >
                      > }
                      >
                      >
                      > ---
                      >
                      >
                      > 123-123-1234
                      > 789-789-7890
                      >
                      >
                      >
                      >
                      >
                      > Most powerful of all, E4X supports "predicate filtering" using the syntax
                      > .(condition), which lets you pick out nodes or attributes that meet a
                      > condition you specify using a Boolean expression. For example, you can pick
                      > out the employee with a particular social security number like this, and get
                      > her state:
                      >
                      >
                      >
                      >
                      >
                      > var ssnToFind:String = "789-789-7890";
                      > trace(employees.employee.(@ssn == ssnToFind)..state);
                      > ---
                      >
                      >
                      > MA
                      >
                      >
                      >
                      >
                      >
                      > Instead of using a simple conditional operator like ==, you can also write a
                      > complicated predicate filtering function to pick out the data you need.
                      >
                      >
                      >
                      >
                      >
                      > By the way, although none of my examples use XML namespaces, E4X has
                      > complete support for them.
                      >
                      >
                      >
                      >
                      >
                      > Compared with the current XML support in the Flash Player, E4X allows you to
                      > write less code and execute it faster because more processing can be done at
                      > the native speed of C++.
                      >
                      >
                      >
                      >
                      >
                      > Since E4X is so powerful, we're working to make Flex 2.0 play nicely with
                      > it. Components like List, ComboBox, and DataGrid will be able to accept E4X
                      > expressions like employees..name as a dataProvider. The <mx:XML> tag will be
                      > able to declare an E4X-style XML object in MXML. WebService and HTTPService
                      > will be able to deliver E4X-style XML objects across the wire, and they'll
                      > use the speed of E4X to do their own work (such as constructing and
                      > desconstrucing SOAP packets) faster.
                      >
                      >
                      >
                      >
                      >
                      > For backward compability, the new player will continue to support the
                      > old-style XML and XMLNode objects, with the one change that the old XML
                      > class will be renamed to XMLDocument. The renaming is necessary because the
                      > E4X standard specifies that the new type be called XML. So if you have XML
                      > code and you want to continue using, just use XMLDocument instead. But we'll
                      > be encouraging everyone to migrate to E4X because it is so much simpler,
                      > faster, and more expressive.
                      >
                      >
                      >
                      >
                      >
                      > Please let us know whether you'll find E4X useful in your particular
                      > applications.
                      >
                      >
                      >
                      >
                      >
                      > - Gordon
                      >
                      >
                      >
                      >
                      >
                      >
                      >
                      >
                      >
                      >
                      >
                      > ________________________________
                      > Yahoo! Groups Links
                      >
                      >
                      > To visit your group on the web, go to:
                      > http://groups.yahoo.com/group/flexcoders/
                      >
                      > To unsubscribe from this group, send an email to:
                      > flexcoders-unsubscribe@yahoogroups.com
                      >
                      > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


                      --
                      Regards,
                      Scott Barnes
                      http://www.mossyblog.com
                      http://www.flexcoder.com (Coming Soon)
                    • Tolulope Olonade
                      HOW DO I JOIN THE FLEX.NET ALPHA/BETA TEST GROUP????????? :-) ________________________________ From: flexcoders@yahoogroups.com
                      Message 10 of 16 , May 17, 2005

                        HOW DO I JOIN THE FLEX.NET ALPHA/BETA TEST GROUP????????? J

                         

                         


                        From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com ] On Behalf Of Scott Barnes
                        Sent: Wednesday, May 18, 2005 5:13 AM
                        To: flexcoders@yahoogroups.com
                        Subject: Re: [flexcoders] E4X in Flex 2.0, part 1: Reading XML

                         

                        heheheheheheh thats funny.

                        I had to do a double take and thought "am i reading the right list here or..."

                        Nice work ;)


                        On 5/18/05, Hans Omli <hansomli@...> wrote:

                        > I don't suppose we'll be reading part 2 of this email via FlexCoders then.
                        > ;-)

                        >  ________________________________
                        >  From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com ] On
                        > Behalf Of Gordon Smith
                        > Sent: Tuesday, May 17, 2005 5:15 PM
                        > To: ' flexcoders@yahoogroups.com '
                        > Subject: RE: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
                        >


                        > Oops... I meant to send this to an internal group, not to flexcoders. Enjoy
                        > the information, but, for now, don't expect this level of detail about our
                        > future plans. Of course, we do want your feedback on features for the next
                        > release, and we'll be sharing more plans with you in the future, as we get
                        > closer to the next release.
                        >  
                        > Sorry,
                        > Gordon


                        > -----Original Message-----
                        > From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com ] On
                        > Behalf Of Gordon Smith
                        > Sent: Tuesday, May 17, 2005 4:54 PM
                        > To: ' flexcoders@yahoogroups.com '
                        > Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
                        >



                        >
                        > As you may have gathered, we've been spending a lot of time lately
                        > leveraging the new features of the Flash Player in the new Flex application
                        > model. Naturally, you'll also be able to leverage those same new features,
                        > so we thought we'd start giving you a run down of what's new. Of course we
                        > don't have beta software for you to play with yet, so for now, we'll provide
                        > a lot of detail so you can evaluate these new features and give guidance for
                        > us.
                        >
                        >  
                        >
                        > XML manipulation in Flex 2.0 is going to get a lot more powerful, as well as
                        > faster. By the time that Flex 2.0 ships, the Flash Player will support E4X
                        > ("ECMAScript for XML"), a set of programming language extensions adding
                        > native XML support to ECMAScript. The player team is busy implementing
                        > Standard ECMA-357 as described in
                        > http://www.ecma-international.org/publications/standards/Ecma-357.htm.

                        >
                        >  

                        >
                        > Here's how the spec describes what this feature offers: "E4X adds native XML
                        > datatypes to the ECMAScript language, extends the semantics of familiar
                        > ECMAScript operators for manipulating XML objects and adds a small set of
                        > new operators for common XML operations, such as searching and filtering. It
                        > also adds support for XML literals, namespaces, qualified names and other
                        > mechanisms to facilitate XML processing."

                        >
                        >  

                        >
                        > Lets take a look at a few examples of how you can read XML data using E4X.

                        >
                        >  

                        >
                        > As in the current player, you'll be able to create variables of type XML by
                        > parsing a String. But XML literals will now be supported as well:

                        >
                        >  

                        >
                        >     var employees:XML =
                        >         <employees>
                        >             <employee ssn="123-123-1234">
                        >                 <name first="John" last="Doe"/>
                        >                 <address>
                        >                     <street> 11 Main St. </street>
                        >                     <city> San Francisco </city>
                        >                     <state>CA</state>
                        >                     <zip>98765</zip>
                        >                 </address>
                        >             </employee>
                        >             <employee ssn="789-789-7890">
                        >                 <name first="Mary" last="Roe"/>
                        >                 <address>
                        >                     <street>99 Broad St. </street>
                        >                     <city> Newton </city>
                        >                     <state>MA</state>
                        >                     <zip>01234</zip>
                        >                 </address>
                        >             </employee>
                        >         </employees>;

                        >
                        >  

                        >
                        > Instead of using DOM-style APIs like firstChild, nextSibling, etc., with E4X
                        > you just "dot down" to grab the node you want. Multiple nodes are indexable
                        > with [n], similar to the elements of an Array:

                        >
                        >  

                        >
                        >     trace(employees.employee[0].address.zip);

                        >
                        >     ---

                        >
                        >     98765

                        >
                        >  

                        >
                        > To grab an attribute, you just use the .@ operator:

                        >
                        >  

                        >
                        >     trace(employees.employee[1].@ssn);
                        >     ---


                        >
                        >     789-789-7890

                        >
                        >  

                        >
                        > If you don't pick out a particular node, you get all of them, as an
                        > indexable list:

                        >
                        >  

                        >
                        >     trace(employees.employee.name);

                        >
                        >     ---

                        >
                        >     <name first="John" last="Doe"/>

                        >
                        >     <name first="Mary" last="Roe"/>

                        >
                        >  

                        >
                        > (And note that nodes even toString() themselves into formatted XML!)

                        >
                        >  


                        >
                        > A handy double-dot operator lets you omit the "path" down into the XML
                        > expression, so you could shorten the previous three examples to

                        >
                        >  

                        >
                        >     trace(employees..zip[0]);


                        >
                        >     trace(employees..@ssn[1]);


                        >
                        >     trace(employees..name);

                        >
                        >  
                        >
                        > You can use a * wildcard to get a list of multiple nodes or attributes with
                        > various names, and the resulting list is indexable:

                        >
                        >  

                        >
                        >     trace(employees.employee[0].address.*);

                        >
                        >     ---

                        >
                        >     <street> 11 Main St. </street>

                        >
                        >     <city> San Francisco </city>

                        >
                        >     <state>CA</state>

                        >
                        >     <zip>98765</zip>

                        >
                        >     trace(employees.employee[0].name.@*[1]);
                        >     ---

                        >
                        >     Doe

                        >
                        >  

                        >
                        > You don't have to hard-code the identifiers for the nodes or attributes...
                        > they can themselves be variables:



                        >
                        >  

                        >
                        >     var whichNode:String = "zip";
                        >     trace(employees.employee[0].address[whichNode]);

                        >
                        >     ---

                        >
                        >     98765

                        >
                        >  


                        >
                        >     var whichAttribute:String = "ssn";
                        >     trace(employees.employee[1].@[whichAttribute]);
                        >     ---

                        >
                        >     789-789-7890

                        >
                        >  

                        >
                        > A new for-each loop lets you loop over multiple nodes or attributes:

                        >
                        >  

                        >
                        >     for each (var ssn:XML in employees..@ssn)

                        >
                        >     {

                        >
                        >         trace(ssn);

                        >
                        >     }

                        >
                        >     ---

                        >
                        >     123-123-1234
                        >     789-789-7890

                        >
                        >  

                        >
                        > Most powerful of all, E4X supports "predicate filtering" using the syntax
                        > .(condition), which lets you pick out nodes or attributes that meet a
                        > condition you specify using a Boolean expression. For example, you can pick
                        > out the employee with a particular social security number like this, and get
                        > her state:

                        >
                        >  

                        >
                        >     var ssnToFind:String = "789-789-7890";
                        >     trace(employees.employee.(@ssn == ssnToFind)..state);
                        >     ---

                        >
                        >     MA

                        >
                        >  

                        >
                        > Instead of using a simple conditional operator like ==, you can also write a
                        > complicated predicate filtering function to pick out the data you need.

                        >
                        >  

                        >
                        > By the way, although none of my examples use XML namespaces, E4X has
                        > complete support for them.

                        >
                        >  

                        >
                        > Compared with the current XML support in the Flash Player, E4X allows you to
                        > write less code and execute it faster because more processing can be done at
                        > the native speed of C++.

                        >
                        >  

                        >
                        > Since E4X is so powerful, we're working to make Flex 2.0 play nicely with
                        > it. Components like List, ComboBox, and DataGrid will be able to accept E4X
                        > expressions like employees..name as a dataProvider. The <mx:XML> tag will be
                        > able to declare an E4X-style XML object in MXML. WebService and HTTPService
                        > will be able to deliver E4X-style XML objects across the wire, and they'll
                        > use the speed of E4X to do their own work (such as constructing and
                        > desconstrucing SOAP packets) faster.

                        >
                        >  

                        >
                        > For backward compability, the new player will continue to support the
                        > old-style XML and XMLNode objects, with the one change that the old XML
                        > class will be renamed to XMLDocument. The renaming is necessary because the
                        > E4X standard specifies that the new type be called XML. So if you have XML
                        > code and you want to continue using, just use XMLDocument instead. But we'll
                        > be encouraging everyone to migrate to E4X because it is so much simpler,
                        > faster, and more expressive.

                        >
                        >  

                        >
                        > Please let us know whether you'll find E4X useful in your particular
                        > applications.

                        >
                        >  

                        >
                        > - Gordon

                        >
                        >
                        >  

                        >
                        >
                        >  

                        >
                        >  
                        >  ________________________________
                        >  Yahoo! Groups Links


                        > To visit your group on the web, go to:
                        > http://groups.yahoo.com/group/flexcoders/
                        >  
                        > To unsubscribe from this group, send an email to:
                        > flexcoders-unsubscribe@yahoogroups.com
                        >  
                        > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


                        --
                        Regards,
                        Scott Barnes
                        http://www.mossyblog.com
                        http://www.flexcoder.com (Coming Soon)

                      • Scott Barnes
                        You have to know the secret handshake, aswell as perform a series of trials ..i call them rights of flex-passage :) heh, umm i think they aren t even at the
                        Message 11 of 16 , May 18, 2005
                          You have to know the secret handshake, aswell as perform a series of
                          trials ..i call them rights of flex-passage :)

                          heh, umm i think they aren't even at the stage of Alpha yet, let alone
                          any secret squiirel groups.

                          :)

                          ... or are they...hrmm! ;)

                          --
                          Regards,
                          Scott Barnes
                          http://www.mossyblog.com
                          http://www.flexcoder.com (Coming Soon)
                        • Dave
                          Development time on my current project would be reduced considerably (as much as half) if I had access to this type of functionality. The $64M question...WHEN
                          Message 12 of 16 , May 18, 2005
                            Development time on my current project would be reduced considerably
                            (as much as half) if I had access to this type of functionality.

                            The $64M question...WHEN WILL FLEX 2.0 BE AVAILABLE - EVEN IN A
                            BETA FORMAT?????


                            Thanks,

                            -Dave



                            --- In flexcoders@yahoogroups.com, "Jeff Steiner" <jeff@f...> wrote:
                            > That is flat out increadible.
                            >
                            > I can't wait!
                            >
                            > Jeff
                            > http://www.flexauthority.com
                            >
                            > ----- Original Message -----
                            > From: "Jeff Beeman" <jeffrey.beeman@a...>
                            > To: <flexcoders@yahoogroups.com>
                            > Sent: Tuesday, May 17, 2005 5:04 PM
                            > Subject: RE: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
                            >
                            >
                            > This is very exciting! I'm especially excited about the double-
                            dot and
                            > wildcard operators. Thanks for this update, as it'll help with
                            planning
                            > for future projects. Keep 'em coming!
                            >
                            >
                            >
                            >
                            >
                            > /******************************************
                            > * Jeff Beeman
                            > ******************************************/
                            >
                            > _____
                            >
                            > From: flexcoders@yahoogroups.com
                            [mailto:flexcoders@yahoogroups.com] On
                            > Behalf Of Gordon Smith
                            > Sent: Tuesday, May 17, 2005 4:54 PM
                            > To: 'flexcoders@yahoogroups.com'
                            > Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
                            >
                            >
                            >
                            > As you may have gathered, we've been spending a lot of time lately
                            > leveraging the new features of the Flash Player in the new Flex
                            > application model. Naturally, you'll also be able to leverage
                            those same
                            > new features, so we thought we'd start giving you a run down of
                            what's
                            > new. Of course we don't have beta software for you to play with
                            yet, so
                            > for now, we'll provide a lot of detail so you can evaluate these
                            new
                            > features and give guidance for us.
                            >
                            >
                            >
                            > XML manipulation in Flex 2.0 is going to get a lot more powerful,
                            as
                            > well as faster. By the time that Flex 2.0 ships, the Flash Player
                            will
                            > support E4X ("ECMAScript for XML"), a set of programming language
                            > extensions adding native XML support to ECMAScript. The player
                            team is
                            > busy implementing Standard ECMA-357 as described in
                            > http://www.ecma-international.org/publications/standards/Ecma-
                            357.htm.
                            >
                            >
                            >
                            > Here's how the spec describes what this feature offers: "E4X adds
                            native
                            > XML datatypes to the ECMAScript language, extends the semantics of
                            > familiar ECMAScript operators for manipulating XML objects and
                            adds a
                            > small set of new operators for common XML operations, such as
                            searching
                            > and filtering. It also adds support for XML literals, namespaces,
                            > qualified names and other mechanisms to facilitate XML processing."
                            >
                            >
                            >
                            > Lets take a look at a few examples of how you can read XML data
                            using
                            > E4X.
                            >
                            >
                            >
                            > As in the current player, you'll be able to create variables of
                            type XML
                            > by parsing a String. But XML literals will now be supported as
                            well:
                            >
                            >
                            >
                            > var employees:XML =
                            > <employees>
                            > <employee ssn="123-123-1234">
                            > <name first="John" last="Doe"/>
                            > <address>
                            > <street>11 Main St.</street>
                            > <city>San Francisco</city>
                            > <state>CA</state>
                            > <zip>98765</zip>
                            > </address>
                            > </employee>
                            > <employee ssn="789-789-7890">
                            > <name first="Mary" last="Roe"/>
                            > <address>
                            > <street>99 Broad St.</street>
                            > <city>Newton</city>
                            > <state>MA</state>
                            > <zip>01234</zip>
                            > </address>
                            > </employee>
                            > </employees>;
                            >
                            >
                            >
                            > Instead of using DOM-style APIs like firstChild, nextSibling,
                            etc., with
                            > E4X you just "dot down" to grab the node you want. Multiple nodes
                            are
                            > indexable with [n], similar to the elements of an Array:
                            >
                            >
                            >
                            > trace(employees.employee[0].address.zip);
                            >
                            > ---
                            >
                            > 98765
                            >
                            >
                            >
                            > To grab an attribute, you just use the .@ operator:
                            >
                            >
                            >
                            > trace(employees.employee[1].@ssn);
                            > ---
                            >
                            > 789-789-7890
                            >
                            >
                            >
                            > If you don't pick out a particular node, you get all of them, as an
                            > indexable list:
                            >
                            >
                            >
                            > trace(employees.employee.name);
                            >
                            > ---
                            >
                            > <name first="John" last="Doe"/>
                            >
                            > <name first="Mary" last="Roe"/>
                            >
                            >
                            >
                            > (And note that nodes even toString() themselves into formatted
                            XML!)
                            >
                            >
                            >
                            > A handy double-dot operator lets you omit the "path" down into the
                            XML
                            > expression, so you could shorten the previous three examples to
                            >
                            >
                            >
                            > trace(employees..zip[0]);
                            >
                            > trace(employees..@ssn[1 <mailto:employees..@ssn%5b1> ]);
                            >
                            > trace(employees..name);
                            >
                            >
                            >
                            > You can use a * wildcard to get a list of multiple nodes or
                            attributes
                            > with various names, and the resulting list is indexable:
                            >
                            >
                            >
                            > trace(employees.employee[0].address.*);
                            >
                            > ---
                            >
                            > <street>11 Main St.</street>
                            >
                            > <city>San Francisco</city>
                            >
                            > <state>CA</state>
                            >
                            > <zip>98765</zip>
                            >
                            > trace(employees.employee[0].name.@*[1]);
                            > ---
                            >
                            > Doe
                            >
                            >
                            >
                            > You don't have to hard-code the identifiers for the nodes or
                            > attributes... they can themselves be variables:
                            >
                            >
                            >
                            > var whichNode:String = "zip";
                            > trace(employees.employee[0].address[whichNode]);
                            >
                            > ---
                            >
                            > 98765
                            >
                            >
                            >
                            > var whichAttribute:String = "ssn";
                            > trace(employees.employee[1].@[whichAttribute]);
                            > ---
                            >
                            > 789-789-7890
                            >
                            >
                            >
                            > A new for-each loop lets you loop over multiple nodes or
                            attributes:
                            >
                            >
                            >
                            > for each (var ssn:XML in employees..@ssn
                            <mailto:employees..@ssn> )
                            >
                            > {
                            >
                            > trace(ssn);
                            >
                            > }
                            >
                            > ---
                            >
                            > 123-123-1234
                            > 789-789-7890
                            >
                            >
                            >
                            > Most powerful of all, E4X supports "predicate filtering" using the
                            > syntax .(condition), which lets you pick out nodes or attributes
                            that
                            > meet a condition you specify using a Boolean expression. For
                            example,
                            > you can pick out the employee with a particular social security
                            number
                            > like this, and get her state:
                            >
                            >
                            >
                            > var ssnToFind:String = "789-789-7890";
                            > trace(employees.employee.(@ssn == ssnToFind)..state);
                            > ---
                            >
                            > MA
                            >
                            >
                            >
                            > Instead of using a simple conditional operator like ==, you can
                            also
                            > write a complicated predicate filtering function to pick out the
                            data
                            > you need.
                            >
                            >
                            >
                            > By the way, although none of my examples use XML namespaces, E4X
                            has
                            > complete support for them.
                            >
                            >
                            >
                            > Compared with the current XML support in the Flash Player, E4X
                            allows
                            > you to write less code and execute it faster because more
                            processing can
                            > be done at the native speed of C++.
                            >
                            >
                            >
                            > Since E4X is so powerful, we're working to make Flex 2.0 play
                            nicely
                            > with it. Components like List, ComboBox, and DataGrid will be able
                            to
                            > accept E4X expressions like employees..name as a dataProvider. The
                            > <mx:XML> tag will be able to declare an E4X-style XML object in
                            MXML.
                            > WebService and HTTPService will be able to deliver E4X-style XML
                            objects
                            > across the wire, and they'll use the speed of E4X to do their own
                            work
                            > (such as constructing and desconstrucing SOAP packets) faster.
                            >
                            >
                            >
                            > For backward compability, the new player will continue to support
                            the
                            > old-style XML and XMLNode objects, with the one change that the
                            old XML
                            > class will be renamed to XMLDocument. The renaming is necessary
                            because
                            > the E4X standard specifies that the new type be called XML. So if
                            you
                            > have XML code and you want to continue using, just use XMLDocument
                            > instead. But we'll be encouraging everyone to migrate to E4X
                            because it
                            > is so much simpler, faster, and more expressive.
                            >
                            >
                            >
                            > Please let us know whether you'll find E4X useful in your
                            particular
                            > applications.
                            >
                            >
                            >
                            > - Gordon
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            >
                            > _____
                            >
                            > Yahoo! Groups Links
                            >
                            > * To visit your group on the web, go to:
                            > http://groups.yahoo.com/group/flexcoders/
                            >
                            > * To unsubscribe from this group, send an email to:
                            > flexcoders-unsubscribe@yahoogroups.com
                            > <mailto:flexcoders-unsubscribe@yahoogroups.com?
                            subject=Unsubscribe>
                            >
                            > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                            > Service <http://docs.yahoo.com/info/terms/> .
                          • Jonathan Bezuidenhout
                            Thanks Gordon, It sounds great - esp. with regard to attributes and the filtering. WebService and HTTPService will be able to deliver E4X-style XML
                            Message 13 of 16 , May 18, 2005
                              Thanks Gordon,

                              It sounds great - esp. with regard to attributes and the filtering.

                              <snip>
                              WebService and HTTPService will be able to deliver E4X-style XML
                              objects across the wire, and they'll use the speed of E4X to do their
                              own work (such as constructing and desconstrucing SOAP packets)
                              faster.
                              </snip>

                              My request would be to be able to do the same thing if you send XML
                              via a RemoteObject as a XML document. We cannot use WebService and
                              HTTPService from the client for a variety of reasons, so we need to
                              send this info via RemoteObject.

                              Thanks

                              Jonathan
                            • Matt Chotin
                              There is nothing active in our Flex.NET forums right now so don t worry about it :-) _____ From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com]
                              Message 14 of 16 , May 18, 2005

                                There is nothing active in our Flex.NET forums right now so don’t worry about it J

                                 


                                From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com ] On Behalf Of Scott Barnes
                                Sent: Wednesday, May 18, 2005 2:37 AM
                                To: flexcoders@yahoogroups.com
                                Subject: Re: [flexcoders] E4X in Flex 2.0, part 1: Reading XML

                                 

                                You have to know the secret handshake, aswell as perform a series of
                                trials ..i call them rights of flex-passage :)

                                heh, umm i think they aren't even at the stage of Alpha yet, let alone
                                any secret squiirel groups.

                                :)

                                ... or are they...hrmm! ;)

                                --
                                Regards,
                                Scott Barnes
                                http://www.mossyblog.com
                                http://www.flexcoder.com (Coming Soon)

                              • Matt Chotin
                                We ve said many times now that there is no public date available on Flex 2 including beta. But as David Mendels has said before, it s still a ways out. Matt
                                Message 15 of 16 , May 18, 2005

                                  We’ve said many times now that there is no public date available on Flex 2 including beta.  But as David Mendels has said before, it’s still a ways out.

                                   

                                  Matt

                                   


                                  From: flexcoders@yahoogroups.com [mailto: flexcoders@yahoogroups.com ] On Behalf Of Dave
                                  Sent: Wednesday, May 18, 2005 6:31 AM
                                  To: flexcoders@yahoogroups.com
                                  Subject: [flexcoders] Re: E4X in Flex 2.0, part 1: Reading XML

                                   

                                  Development time on my current project would be reduced considerably
                                  (as much as half) if I had access to this type of functionality.

                                  The $64M question...WHEN WILL FLEX 2.0  BE AVAILABLE - EVEN IN A
                                  BETA FORMAT?????


                                  Thanks,

                                  -Dave



                                  --- In flexcoders@yahoogroups.com , "Jeff Steiner" <jeff@f...> wrote:
                                  > That is flat out increadible.
                                  >
                                  > I can't wait!
                                  >
                                  > Jeff
                                  > http://www.flexauthority.com
                                  >
                                  > ----- Original Message -----
                                  > From: "Jeff Beeman" <jeffrey.beeman@a...>
                                  > To: < flexcoders@yahoogroups.com >
                                  > Sent: Tuesday, May 17, 2005 5:04 PM
                                  > Subject: RE: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
                                  >
                                  >
                                  > This is very exciting!  I'm especially excited about the double-
                                  dot and
                                  > wildcard operators.  Thanks for this update, as it'll help with
                                  planning
                                  > for future projects.  Keep 'em coming!
                                  >

                                  >

                                  >
                                  > /******************************************
                                  > * Jeff Beeman
                                  > ******************************************/
                                  >
                                  >   _____ 
                                  >
                                  > From: flexcoders@yahoogroups.com
                                  [mailto: flexcoders@yahoogroups.com ] On
                                  > Behalf Of Gordon Smith
                                  > Sent: Tuesday, May 17, 2005 4:54 PM
                                  > To: ' flexcoders@yahoogroups.com '
                                  > Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
                                  >

                                  >
                                  > As you may have gathered, we've been spending a lot of time lately
                                  > leveraging the new features of the Flash Player in the new Flex
                                  > application model. Naturally, you'll also be able to leverage
                                  those same
                                  > new features, so we thought we'd start giving you a run down of
                                  what's
                                  > new. Of course we don't have beta software for you to play with
                                  yet, so
                                  > for now, we'll provide a lot of detail so you can evaluate these
                                  new
                                  > features and give guidance for us.
                                  >

                                  >
                                  > XML manipulation in Flex 2.0 is going to get a lot more powerful,
                                  as
                                  > well as faster. By the time that Flex 2.0 ships, the Flash Player
                                  will
                                  > support E4X ("ECMAScript for XML"), a set of programming language
                                  > extensions adding native XML support to ECMAScript. The player
                                  team is
                                  > busy implementing Standard ECMA-357 as described in
                                  > http://www.ecma-international.org/publications/standards/Ecma-
                                  357.htm.
                                  >

                                  >
                                  > Here's how the spec describes what this feature offers: "E4X adds
                                  native
                                  > XML datatypes to the ECMAScript language, extends the semantics of
                                  > familiar ECMAScript operators for manipulating XML objects and
                                  adds a
                                  > small set of new operators for common XML operations, such as
                                  searching
                                  > and filtering. It also adds support for XML literals, namespaces,
                                  > qualified names and other mechanisms to facilitate XML processing."
                                  >

                                  >
                                  > Lets take a look at a few examples of how you can read XML data
                                  using
                                  > E4X.
                                  >

                                  >
                                  > As in the current player, you'll be able to create variables of
                                  type XML
                                  > by parsing a String. But XML literals will now be supported as
                                  well:
                                  >

                                  >
                                  >     var employees:XML =
                                  >         <employees>
                                  >             <employee ssn="123-123-1234">
                                  >                 <name first="John" last="Doe"/>
                                  >                 <address>
                                  >                     <street> 11 Main St. </street>
                                  >                     <city> San Francisco </city>
                                  >                     <state>CA</state>
                                  >                     <zip>98765</zip>
                                  >                 </address>
                                  >             </employee>
                                  >             <employee ssn="789-789-7890">
                                  >                 <name first="Mary" last="Roe"/>
                                  >                 <address>
                                  >                     <street>99 Broad St. </street>
                                  >                     <city> Newton </city>
                                  >                     <state>MA</state>
                                  >                     <zip>01234</zip>
                                  >                 </address>
                                  >             </employee>
                                  >         </employees>;
                                  >

                                  >
                                  > Instead of using DOM-style APIs like firstChild, nextSibling,
                                  etc., with
                                  > E4X you just "dot down" to grab the node you want. Multiple nodes
                                  are
                                  > indexable with [n], similar to the elements of an Array:
                                  >

                                  >
                                  >     trace(employees.employee[0].address.zip);
                                  >
                                  >     ---
                                  >
                                  >     98765
                                  >

                                  >
                                  > To grab an attribute, you just use the .@ operator:
                                  >

                                  >
                                  >     trace(employees.employee[1].@ssn);
                                  >     ---
                                  >
                                  >     789-789-7890
                                  >

                                  >
                                  > If you don't pick out a particular node, you get all of them, as an
                                  > indexable list:
                                  >

                                  >
                                  >     trace(employees.employee.name);
                                  >
                                  >     ---
                                  >
                                  >     <name first="John" last="Doe"/>
                                  >
                                  >     <name first="Mary" last="Roe"/>
                                  >

                                  >
                                  > (And note that nodes even toString() themselves into formatted
                                  XML!)
                                  >

                                  >
                                  > A handy double-dot operator lets you omit the "path" down into the
                                  XML
                                  > expression, so you could shorten the previous three examples to
                                  >

                                  >
                                  >     trace(employees..zip[0]);
                                  >
                                  >     trace(employees..@ssn[1 <mailto:employees..@ssn%5b1> ]);
                                  >
                                  >     trace(employees..name);
                                  >

                                  >
                                  > You can use a * wildcard to get a list of multiple nodes or
                                  attributes
                                  > with various names, and the resulting list is indexable:
                                  >

                                  >
                                  >     trace(employees.employee[0].address.*);
                                  >
                                  >     ---
                                  >
                                  >     <street> 11 Main St. </street>
                                  >
                                  >     <city> San Francisco </city>
                                  >
                                  >     <state>CA</state>
                                  >
                                  >     <zip>98765</zip>
                                  >
                                  >     trace(employees.employee[0].name.@*[1]);
                                  >     ---
                                  >
                                  >     Doe
                                  >

                                  >
                                  > You don't have to hard-code the identifiers for the nodes or
                                  > attributes... they can themselves be variables:
                                  >

                                  >
                                  >     var whichNode:String = "zip";
                                  >     trace(employees.employee[0].address[whichNode]);
                                  >
                                  >     ---
                                  >
                                  >     98765
                                  >

                                  >
                                  >     var whichAttribute:String = "ssn";
                                  >     trace(employees.employee[1].@[whichAttribute]);
                                  >     ---
                                  >
                                  >     789-789-7890
                                  >

                                  >
                                  > A new for-each loop lets you loop over multiple nodes or
                                  attributes:
                                  >

                                  >
                                  >     for each (var ssn:XML in employees..@ssn
                                  <mailto:employees..@ssn> )
                                  >
                                  >     {
                                  >
                                  >         trace(ssn);
                                  >
                                  >     }
                                  >
                                  >     ---
                                  >
                                  >     123-123-1234
                                  >     789-789-7890
                                  >

                                  >
                                  > Most powerful of all, E4X supports "predicate filtering" using the
                                  > syntax .(condition), which lets you pick out nodes or attributes
                                  that
                                  > meet a condition you specify using a Boolean expression. For
                                  example,
                                  > you can pick out the employee with a particular social security
                                  number
                                  > like this, and get her state:
                                  >

                                  >
                                  >     var ssnToFind:String = "789-789-7890";
                                  >     trace(employees.employee.(@ssn == ssnToFind)..state);
                                  >     ---
                                  >
                                  >     MA
                                  >

                                  >
                                  > Instead of using a simple conditional operator like ==, you can
                                  also
                                  > write a complicated predicate filtering function to pick out the
                                  data
                                  > you need.
                                  >

                                  >
                                  > By the way, although none of my examples use XML namespaces, E4X
                                  has
                                  > complete support for them.
                                  >

                                  >
                                  > Compared with the current XML support in the Flash Player, E4X
                                  allows
                                  > you to write less code and execute it faster because more
                                  processing can
                                  > be done at the native speed of C++.
                                  >

                                  >
                                  > Since E4X is so powerful, we're working to make Flex 2.0 play
                                  nicely
                                  > with it. Components like List, ComboBox, and DataGrid will be able
                                  to
                                  > accept E4X expressions like employees..name as a dataProvider. The
                                  > <mx:XML> tag will be able to declare an E4X-style XML object in
                                  MXML.
                                  > WebService and HTTPService will be able to deliver E4X-style XML
                                  objects
                                  > across the wire, and they'll use the speed of E4X to do their own
                                  work
                                  > (such as constructing and desconstrucing SOAP packets) faster.
                                  >

                                  >
                                  > For backward compability, the new player will continue to support
                                  the
                                  > old-style XML and XMLNode objects, with the one change that the
                                  old XML
                                  > class will be renamed to XMLDocument. The renaming is necessary
                                  because
                                  > the E4X standard specifies that the new type be called XML. So if
                                  you
                                  > have XML code and you want to continue using, just use XMLDocument
                                  > instead. But we'll be encouraging everyone to migrate to E4X
                                  because it
                                  > is so much simpler, faster, and more expressive.
                                  >

                                  >
                                  > Please let us know whether you'll find E4X useful in your
                                  particular
                                  > applications.
                                  >

                                  >
                                  > - Gordon
                                  >
                                  >

                                  >
                                  >

                                  >

                                  >

                                  >
                                  >   _____ 
                                  >
                                  > Yahoo! Groups Links
                                  >
                                  > * To visit your group on the web, go to:
                                  > http://groups.yahoo.com/group/flexcoders/
                                  >  
                                  > * To unsubscribe from this group, send an email to:
                                  > flexcoders-unsubscribe@yahoogroups.com
                                  > <mailto:flexcoders-unsubscribe@yahoogroups.com?
                                  subject=Unsubscribe>
                                  >  
                                  > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
                                  > Service <http://docs.yahoo.com/info/terms/> .



                                • Sho Kuwamoto
                                  Ha ha.. :-) I was wondering why you were being so open about this stuff! No harm done, and it s only a taste of some of the great stuff we re thinking about,
                                  Message 16 of 16 , May 19, 2005
                                    Ha ha.. :-) I was wondering why you were being so open about this stuff!
                                     
                                    No harm done, and it's only a taste of some of the great stuff we're thinking about, guys! ;-)
                                     
                                    -Sho


                                    From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
                                    Sent: Tuesday, May 17, 2005 5:32 PM
                                    To: 'flexcoders@yahoogroups.com'
                                    Subject: RE: [flexcoders] E4X in Flex 2.0, part 1: Reading XML

                                    OK, OK. Next time I'll try to leak something that will get me fired.
                                    Somebody on the list can give me a job as a Flex developer.

                                    - Gordon


                                    -----Original Message-----
                                    From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On
                                    Behalf Of James Ward
                                    Sent: Tuesday, May 17, 2005 5:24 PM
                                    To: flexcoders@yahoogroups.com
                                    Subject: RE: [flexcoders] E4X in Flex 2.0, part 1: Reading XML


                                    ROFL!  Come on Gordon!  If you are going to accidentally leak info, can
                                    you make it a bit juicier?  ;)  Maybe something about some super-secret
                                    project or the Adobe buyout or Flex 2 release dates.  This is good info,
                                    but not *that* exciting!

                                    Still laughing...  :)

                                    -James


                                    On Tue, 2005-05-17 at 17:15 -0700, Gordon Smith wrote:
                                    > Oops... I meant to
                                    send this to an internal group, not to flexcoders.
                                    > Enjoy the
                                    information, but, for now, don't expect this level of detail
                                    > about our
                                    future plans. Of course, we do want your feedback on
                                    > features for the
                                    next release, and we'll be sharing more plans with
                                    > you in the future, as
                                    we get closer to the next release.

                                    > Sorry,
                                    >
                                    Gordon
                                    >         -----Original
                                    Message-----
                                    >         From:
                                    flexcoders@yahoogroups.com
                                    >        
                                    [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith
                                    >         Sent: Tuesday, May
                                    17, 2005 4:54 PM
                                    >         To:
                                    'flexcoders@yahoogroups.com'
                                    >        
                                    Subject: [flexcoders] E4X in Flex 2.0, part 1: Reading XML
                                    >        
                                    >        
                                    >         As you may have
                                    gathered, we've been spending a lot of time
                                    >         lately leveraging
                                    the new features of the Flash Player in the
                                    >         new Flex application
                                    model. Naturally, you'll also be able to
                                    >         leverage those same
                                    new features, so we thought we'd start
                                    >         giving you a run
                                    down of what's new. Of course we don't have
                                    >         beta software for
                                    you to play with yet, so for now, we'll
                                    >         provide a lot of
                                    detail so you can evaluate these new features
                                    >         and give
                                    guidance for us.
                                    >        
                                    >         
                                    >        
                                    >         XML manipulation in
                                    Flex 2.0 is going to get a lot more
                                    >         powerful, as well
                                    as faster. By the time that Flex 2.0 ships,
                                    >         the Flash Player
                                    will support E4X ("ECMAScript for XML"), a
                                    >         set of programming
                                    language extensions adding native XML
                                    >         support to
                                    ECMAScript. The player team is busy implementing
                                    >         Standard
                                    ECMA-357 as described in
                                    >
                                    http://www.ecma-international.org/publications/standards/Ecma-357.htm.
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         Here's how the spec
                                    describes what this feature offers: "E4X
                                    >         adds native XML
                                    datatypes to the ECMAScript language, extends
                                    >         the semantics of
                                    familiar ECMAScript operators for
                                    >         manipulating XML
                                    objects and adds a small set of new operators
                                    >         for common XML
                                    operations, such as searching and filtering. It
                                    >         also adds support for
                                    XML literals, namespaces, qualified
                                    >         names and
                                    other mechanisms to facilitate XML processing."
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         Lets take a look at a
                                    few examples of how you can read XML
                                    >         data using
                                    E4X.
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         As in the current
                                    player, you'll be able to create variables
                                    >         of type XML by
                                    parsing a String. But XML literals will now be
                                    >         supported as
                                    well:
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >            
                                    var employees:XML =
                                    >                
                                    <employees>
                                    >                    
                                    <employee ssn="123-123-1234">
                                    >                        
                                    <name first="John" last="Doe"/>
                                    >                        
                                    <address>
                                    >                            
                                    <street>11 Main St.</street>
                                    >                            
                                    <city>San Francisco</city>
                                    >                            
                                    <state>CA</state>
                                    >                            
                                    <zip>98765</zip>
                                    >                        
                                    </address>
                                    >                    
                                    </employee>
                                    >                    
                                    <employee ssn="789-789-7890">
                                    >                        
                                    <name first="Mary" last="Roe"/>
                                    >                        
                                    <address>
                                    >                            
                                    <street>99 Broad St.</street>
                                    >                            
                                    <city>Newton</city>
                                    >                            
                                    <state>MA</state>
                                    >                            
                                    <zip>01234</zip>
                                    >                        
                                    </address>
                                    >                    
                                    </employee>
                                    >                
                                    </employees>;
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         Instead of using
                                    DOM-style APIs like firstChild, nextSibling,
                                    >         etc., with
                                    E4X you just "dot down" to grab the node you
                                    >         want. Multiple nodes
                                    are indexable with [n], similar to the
                                    >         elements of an
                                    Array:
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >            
                                    trace(employees.employee[0].address.zip);
                                    >        
                                    >        
                                    >            
                                    ---
                                    >        
                                    >        
                                    >            
                                    98765
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         To grab an attribute,
                                    you just use the .@ operator:
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >            
                                    trace(employees.employee[1].@ssn);
                                    >            
                                    ---
                                    >        
                                    >        
                                    >            
                                    789-789-7890
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         If you don't pick out a
                                    particular node, you get all of them,
                                    >         as an indexable
                                    list:
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >            
                                    trace(employees.employee.name);
                                    >        
                                    >        
                                    >            
                                    ---
                                    >        
                                    >        
                                    >            
                                    <name first="John" last="Doe"/>
                                    >        
                                    >        
                                    >            
                                    <name first="Mary" last="Roe"/>
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         (And note that nodes
                                    even toString() themselves into formatted
                                    >        
                                    XML!)
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         A handy double-dot
                                    operator lets you omit the "path" down into
                                    >         the XML expression,
                                    so you could shorten the previous three
                                    >         examples
                                    to
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >            
                                    trace(employees..zip[0]);
                                    >        
                                    >        
                                    >            
                                    trace(employees..@ssn[1]);
                                    >        
                                    >        
                                    >            
                                    trace(employees..name);
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         You can use a *
                                    wildcard to get a list of multiple nodes or
                                    >         attributes with
                                    various names, and the resulting list is
                                    >        
                                    indexable:
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >            
                                    trace(employees.employee[0].address.*);
                                    >        
                                    >        
                                    >            
                                    ---
                                    >        
                                    >        
                                    >            
                                    <street>11 Main St.</street>
                                    >        
                                    >        
                                    >            
                                    <city>San Francisco</city>
                                    >        
                                    >        
                                    >            
                                    <state>CA</state>
                                    >        
                                    >        
                                    >            
                                    <zip>98765</zip>
                                    >        
                                    >        
                                    >            
                                    trace(employees.employee[0].name.@*[1]);
                                    >            
                                    ---
                                    >        
                                    >        
                                    >            
                                    Doe
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         You don't have to
                                    hard-code the identifiers for the nodes or
                                    >         attributes... they
                                    can themselves be variables:
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >            
                                    var whichNode:String = "zip";
                                    >            
                                    trace(employees.employee[0].address[whichNode]);
                                    >        
                                    >            
                                    ---
                                    >        
                                    >        
                                    >            
                                    98765
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >            
                                    var whichAttribute:String = "ssn";
                                    >            
                                    trace(employees.employee[1].@[whichAttribute]);
                                    >            
                                    ---
                                    >        
                                    >        
                                    >            
                                    789-789-7890
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         A new for-each loop
                                    lets you loop over multiple nodes or
                                    >        
                                    attributes:
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >            
                                    for each (var ssn:XML in employees..@ssn)
                                    >        
                                    >        
                                    >            
                                    {
                                    >        
                                    >        
                                    >                
                                    trace(ssn);
                                    >        
                                    >        
                                    >            
                                    }
                                    >        
                                    >        
                                    >            
                                    ---
                                    >        
                                    >        
                                    >            
                                    123-123-1234
                                    >            
                                    789-789-7890
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         Most powerful of all,
                                    E4X supports "predicate filtering" using
                                    >         the syntax
                                    .(condition), which lets you pick out nodes or
                                    >         attributes that meet
                                    a condition you specify using a Boolean
                                    >         expression. For
                                    example, you can pick out the employee with a
                                    >         particular social
                                    security number like this, and get her
                                    >        
                                    state:
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >            
                                    var ssnToFind:String = "789-789-7890";
                                    >            
                                    trace(employees.employee.(@ssn == ssnToFind)..state);
                                    >            
                                    ---
                                    >        
                                    >        
                                    >            
                                    MA
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         Instead of using a
                                    simple conditional operator like ==, you
                                    >         can also write a
                                    complicated predicate filtering function to
                                    >         pick out the data you
                                    need.
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         By the way, although
                                    none of my examples use XML namespaces,
                                    >         E4X has
                                    complete support for them.
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         Compared with the
                                    current XML support in the Flash Player, E4X
                                    >         allows you to write
                                    less code and execute it faster because
                                    >         more processing
                                    can be done at the native speed of C++.
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         Since E4X is so
                                    powerful, we're working to make Flex 2.0
                                    >         play nicely with it.
                                    Components like List, ComboBox, and
                                    >         DataGrid will be
                                    able to accept E4X expressions like
                                    >         employees..name as
                                    a dataProvider. The <mx:XML> tag will be
                                    >         able to declare an
                                    E4X-style XML object in MXML. WebService
                                    >         and
                                    HTTPService will be able to deliver E4X-style XML objects
                                    >         across the wire,
                                    and they'll use the speed of E4X to do their
                                    >         own work (such as
                                    constructing and desconstrucing SOAP
                                    >         packets)
                                    faster.
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         For backward
                                    compability, the new player will continue to
                                    >         support the old-style
                                    XML and XMLNode objects, with the one
                                    >         change that the old
                                    XML class will be renamed to XMLDocument.
                                    >         The
                                    renaming is necessary because the E4X standard specifies
                                    >         that the new
                                    type be called XML. So if you have XML code and
                                    >         you want to continue
                                    using, just use XMLDocument instead. But
                                    >         we'll be encouraging
                                    everyone to migrate to E4X because it is
                                    >         so much simpler,
                                    faster, and more expressive.
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         Please let us know
                                    whether you'll find E4X useful in your
                                    >         particular
                                    applications.
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         -
                                    Gordon
                                    >        
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >         
                                    >        
                                    >        
                                    >        
                                    >        
                                    >        
                                    ______________________________________________________________
                                    >        
                                    Yahoo! Groups Links
                                    >              
                                    * To visit your group on the web, go to:
                                    >                
                                    http://groups.yahoo.com/group/flexcoders/
                                    >                  
                                    >              
                                    * To unsubscribe from this group, send an email to:
                                    >                
                                    flexcoders-unsubscribe@yahoogroups.com
                                    >                  
                                    >              
                                    * Your use of Yahoo! Groups is subject to the Yahoo!
                                    >                
                                    Terms of Service.
                                    >        





                                    Yahoo! Groups Links






                                  Your message has been successfully submitted and would be delivered to recipients shortly.