1 Reply Latest reply on Mar 30, 2007 12:51 PM by ann.fso

    Evaluating an XML expression within from within an XML node

    keyboardlacky
      I would like to pass in an E4X expression from a node and evaluate that expression.

      For example, let's say the XML looks like this:

      quote:


      <section id="a">
      <item id="1">
      <value>3.1</value>
      </item>
      <item id="2">
      <value>2.2</value>
      </item>
      <item id="3">
      <value calculated="true">{section.(@id=="a").item.(@id=="1").value + section.(@id=="a").item.(@id=="1").value}</value>
      </item>
      </section>



      I would then like to evaluate this from within Flex, displaying each of the values from the three items and evaluating the expression that lies in the third item.

      Note: this doesn't work... (but it's the idea... that is, to retrieve the expression from the XML and evaluate it)...
      quote:


      <mx:Script>
      <![CDATA[
      [Bindable]
      public var xmlHUD:XML;
      ]]>
      </mx:Script>

      <mx:Label text="{myXML.section.item.(@id=='3').value}"/>


      If successful, the label would then display the result from the express in item 3, which would be 5.3 (the result of 3.1 + 2.2).

      Any ideas?
      David