1 Reply Latest reply on Sep 24, 2010 4:51 AM by charlesj1984

    Problem to get inner tag value from XML

    charlesj1984

      Hi Everyone,

       

      I have some problem to acces the inner tag value from XML. Actually my XML data are,

       

      <?xml version="1.0" encoding="utf-8"?>

       

      <routes>

          <route routeID="Rt #1" routename="ABC">

                  <empl>

                      <empid>001</empid>

                      <empname>Charles</empname>

                      <gender>Male</gender>

                      <area>xxxx</area>

                      <landmark>yyyyy</landmark>

                      <distance>8 Km</distance>

                  </empl>

           </route>

      </routes>

       

       

      My flex coding is shown below. Here i am using Item Render for creating the components dynamically. the below code is place in the Item Render file.

       

       

      <mx:VBox width="100%" height="200" paddingLeft="4" paddingRight="4">

              <mx:VBox id="boxItem" width="100%" height="100%" styleName="empDetailsBox">

                  <mx:HBox width="98%">

                      <mx:Label id="email_tb" width="100%" text="{data.@routeID}" fontSize="16" fontWeight="bold" color="0xe30217" truncateToFit="false"/>

                      <mx:Label id="name_tb" width="100%" text="{data.@routename}" truncateToFit="false" height="25"/>

                  </mx:HBox>

       

                  <mx:DataGrid width="98%" dataProvider="{xdata.lastResult.route.empl}" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true" height="130">

                      <mx:columns>

                          <mx:DataGridColumn dataField="empid" headerText="Emp ID" width="75"/>

                          <mx:DataGridColumn dataField="empname" headerText="Emp Name" textAlign="left"/>

                          <mx:DataGridColumn dataField="gender" headerText="Gender" width="60"/>

                          <mx:DataGridColumn dataField="area" headerText="Area" textAlign="left"/>

                          <mx:DataGridColumn dataField="landmark" headerText="Landmark" textAlign="left"/>                                                                      

                          <mx:DataGridColumn dataField="distance" headerText="Distance" width="60"/>                      

                 </mx:columns>

            </mx:DataGrid>

      </mx:VBox>  

       

      i can able to acces the <routeid> and <routename> Values. But i cant able to get the <empl> values. not able to display to my data grid also. so please if anyone know the solution to solve this prob let me know i am waiting for ur reply.