3 Replies Latest reply on Nov 23, 2007 3:47 AM by FuryEgg

    How to use  xml node property?  m( T_T )m

    FuryEgg
      hi,

      XML:
      <allEmployees>
      <employee>
      <person name="fName">Clare</person>
      <person name="lName">DuPre</person>
      <person name="location">Paris</person>
      </employee>
      <employee>
      <person name="fName">David</person>
      <person name="lName">Green</person>
      <person name="location">San Francisco</person>
      </employee>
      </allEmployees>

      MODEL:
      <mx:Model id="empModel" source="employees.xml"/>

      DATAGRID:
      <mx:datagrid dataprovider="{empMode.employee}" ... />

      datagridcolumn:
      <mx:DataGridColumn dataField="person.@fName">

      why can not display every person node correctlly? How can i do?
      thanks for your help....
        • 1. Re: How to use  xml node property?  m( T_T )m
          FuryEgg Level 1
          I want to get a datagrid as follows:
          fName | lName | Location
          Clare Dupre Paris
          David Green San Fran

          accroding to the property of person node to access every person

          help me..
          • 2. Re: How to use  xml node property?  m( T_T )m
            Sreenivas R Adobe Employee
            The following samples work.

            <mx:Model id="empModel" source="emp.xml" />
            <mx:DataGrid dataProvider="{empModel.employee}">
            <mx:columns>
            <mx:DataGridColumn dataField="fName" />
            <mx:DataGridColumn dataField="lName" />
            <mx:DataGridColumn dataField="location" />
            </mx:columns>
            </mx:DataGrid>

            <mx:XML source="emp.xml" id="empXMLModel" />
            <mx:DataGrid dataProvider="{empXMLModel.employee}">
            <mx:columns>
            <mx:DataGridColumn dataField="@fName" headerText="fName" />
            <mx:DataGridColumn dataField="@lName" headerText="lName" />
            <mx:DataGridColumn dataField="@location" headerText="location"/>
            </mx:columns>
            </mx:DataGrid>

            where emp.xml contains

            <allEmployees>
            <employee fName="Clare" lName="DuPre" location="Paris" />
            <employee fName="David" lName="Green" location="San Francisco" />
            </allEmployees>

            The XML structure you are trying to use is not correct. person.@fName doesn't refer to anything. person.@name in diferent nodes would be referring to fName, lName and location values.
            • 3. Re: How to use  xml node property?  m( T_T )m
              FuryEgg Level 1
              thank Sreenivas R very much....