1 Reply Latest reply on Jul 10, 2009 2:02 PM by leybniz

    How can I get the text value of an XML element  in MXML ?

    ballatomm

      Hi,


      I have the following XML loaded into a variable of type XML :

       

      <properties>
           <comment>RIMpro Data Collector Configuration</comment>
           <entry key="server.pear.username"/>
           <entry key="server.apple.retry.times">5</entry>
           <entry key="rdc.proxy.host">http://192.168.1.2:8080</entry>

      /properties>

       

      I can easily get the key attribute displayed in a DataGridColumn by setting the dataProvider to my variable and the dataField to "@key".  But I do not know how to get the text value in a second column...  Is there a way or do I need to change my XML to something like this :

       

      <properties>
           <comment>RIMpro Data Collector Configuration</comment>
           <entry key="server.pear.username"/>
           <entry key="server.apple.retry.times" value="5"></entry>
           <entry key="rdc.proxy.host" value="
      http://192.168.1.2:8080"></entry>

      /properties>

       

      Many thanks in advance.


      Marc

        • 1. Re: How can I get the text value of an XML element  in MXML ?
          leybniz Level 4

          yes, you'd better modify your XML structure to fit the DataGrid internals.

           

          Since dataField pattern require each grid row item to have a named property to be displayed, otherwise you'll be forced to overcome this pattern using custom labelFunction for the particular column which will implement your custom actions on how to extract appropriate data for that column out of grid row item. It will be much more complicated than just rearranging your xml structure.