1 Reply Latest reply on Jul 28, 2009 10:11 AM by Peter deHaan

    fx:XML differences compared to mx:XML

    Tariq Ahmed [ACP] Level 1

      I'm not sure if this is a bug or if behavior has changed.

       

      In Flex 3 if you had users.xml:

      <?xml version="1.0" encoding="utf-8"?>
      <users>
        <user id="1">Joe</user>   
        <user id="2">Jeff</user>   
      </users>

       


      And did an:

      <mx:XML source="users.xml" id="usersXML"/>

       

      And traced usersXML.users.user.length() you'd get 2.

       

      In Flex 4, if you change it to:

      <fx:XML source="users.xml" id="usersXML"/>

       

      The same trace on usersXML.users.user.length(), returns 0. And if you dump the XML to a string, it shows correctly so the data is there.

       

      Bug?

       

      Thx.

        • 1. Re: fx:XML differences compared to mx:XML
          Peter deHaan Level 4

          I cannot repro this in 3.4.0.8798:

           

          Assuming the following XML file, users.xml:

           

           

           

           

           

           

           

           

          <?xml version="1.0" encoding="utf-8"?>
          <users>
              <user id="1">Joe</user>
              <user id="2">Jeff</user>
          </users>
          
          
          

           

           

          The following example displays 0:

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
              <mx:XML source="users.xml" id="usersXML"/>
              <mx:Label text="{usersXML.users.user.length()}" />
          </mx:Application>
          
          

           

           

          And if I try the same code in Flex 4.0.0.8754, it also displays 0:

           

          <?xml version="1.0" encoding="utf-8"?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                  xmlns:s="library://ns.adobe.com/flex/spark">
              <fx:Declarations>
                  <fx:XML source="users.xml" id="usersXML"/>
              </fx:Declarations>
              <s:SimpleText text="{usersXML.users.user.length()}" />
          </s:Application>
          
          

           

           

           

           

          Changing each example to display usersXML.user.length() correctly displays 0.

          Which version/build of the Flex 3 SDK are you using?

           

          Peter