2 Replies Latest reply on Jul 1, 2011 11:21 AM by HarishTVN

    Handling dots in XML data


      Hi. I have a XML data tags as mentioned below, i need to use these tags in my Datagrid column.


      I tried using with braces also but nothing is showing in the output.


      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" x="102" y="53" layout="absolute">
         public var dataXML:XML =
      <mx:DataGrid x="102" y="53" width="476" height="152" dataProvider="{dataXML.ROW}">
         <mx:DataGridColumn headerText="Market" dataField="_Markets_._Market_" />


      Please help...



        • 1. Re: Handling dots in XML data
          blazejewicz Level 4



          You've very unfortunate entity names for automatic conversion I think:

          - they contains dot which is non-allowed for actionscript variable names (but will work anyway at runtime - but do not expect to be able to use dot in code when naming something)

          - there are different element names (nodes) for given level


          Here is solution you could try:


          <mx:DataGrid width="100%" height="100%">
                    <mx:DataGridColumn headerText="Market" labelFunction="labelFunction"/>
                    <mx:XMLListCollection source="{dataXML.ROW}"/>


          and code:


          protected function labelFunction(item:Object, column:DataGridColumn):String
               var node:XML = item as XML;
               var value:String = node.child(0);
               return value;



          I think there is something deep in mx.* code for automatic conversion that fails to correctly translate your entity names into object property names when assigned to data provider instance - but I think above would work (you should re-design your xml though I think),




          • 2. Re: Handling dots in XML data
            HarishTVN Level 1

            Hi Peter,


            It worked... thanks..