1 Reply Latest reply on Dec 18, 2007 1:02 AM by RioVic

    XML Data Binding -- Found a Bug in Flex 3?

    RioVic
      I have found something that might be a bug or maybe I am just doing it wrong. This simple example, right out of the Adobe Flex 3 Help file, does not work:

      <?xml version="1.0"?>
      <!-- Models\XMLBinding.mxml -->
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">
      <mx:XML id="myEmployee" format="e4x">
      <employee>
      <name>
      <first>{firstName.text}</first>
      <last>{lastName.text}</last>
      </name>
      <department>{department.text}</department>
      <email>{email.text}</email>
      </employee>
      </mx:XML>
      <mx:TextInput id="firstName"/>
      <mx:TextInput id="lastName"/>
      <mx:TextInput id="department"/>
      <mx:TextInput id="email"/>
      </mx:Application>

      In the example above, the fields first and last will contain nothing after the binding. What does work is if the curly braces fields are part of the XML tag itself, like this:

      <name first="{firstName.text}" last ="{lastName.text}" />

      Am I the only one who is trying to do this in Flex 3? Is this a change in the way Flex handles binding to XML models?

      Text
        • 1. Re: XML Data Binding -- Found a Bug in Flex 3?
          RioVic Level 1
          oops, I spoke too broadly -- the Flex example does work -- but it fails if you have any qualifiers in the tag, so for example, this works:
          <name>
          <first>{firstName.text}</first>
          <last>{lastName.text}</last>
          </name>

          and this works:
          <name first="{firstName.text}" last ="{lastName.text}" />

          but this does NOT work:
          <name>
          <first type="person">{firstName.text}</first>
          <last type="person">{lastName.text}</last>
          </name>

          so it IS probably a bug in the parser that handles the XML tags, upon seeing one qualifying field within the tag, it assumes that all of the data will be presented in the same way, and there will be no bound data between the tag.