Select to view content in your preferred language

Accessing XML data from Geodatabase export

1909
2
06-13-2012 01:40 PM
PatrickThorstenson
Deactivated User
I am having difficulty accessing the fields from an xml file generated from a geodatabase (XML Recordset Document). I want to populate a dropdown box with landowner names pulled from a parcel polygon layer. I am able to get Flex to see the correct number of total records but I cannot get Flex to see the correct field - in this case called "Owner". I have marked in the code below where I seem to be having the issue.  I have attached a screen capture of the xml export file I am using showing both the expanded Records and Fields. The specific label field I am trying to get Flex is to see is about halfway down the Record values in the screen capture. The field is named "Owner" (and the value in this case is "HOLDEN JERRY CLARK.....)" What do I need to use in the labelField to properly access that "Owner" field. Any help would greatly appreciated. I am very new to the Flex API.

<fx:Declarations>
 
<s:HTTPService id="employeeService"
               url="assets/parceltable.xml"/>
 
</fx:Declarations>

  
<s:Form x="10" y="70">
 
<s:FormItem label="Employee:">
   <s:DropDownList id="dropDownList"
    dataProvider="{employeeService.lastResult.RecordSetData.Data.Records.Record}"    #######This line sees the proper number of records (5).########
    labelField="Owner"/>   ##########Here is where I am having the problem#########
</s:FormItem>

[ATTACH=CONFIG]15194[/ATTACH]
0 Kudos
2 Replies
IvanBespalov
Frequent Contributor
Using HttpService components (with samples - how to listen result/fault events, how to set additional parameters)
Spark DropDownList control (with samples). It's dataProvider must be an IList.

A good sample of "How to Access XML data" is reading data from configuration xml files in ArcGIS Viewer for Flex.

The first day trainings in "Flex in a Week video training" (from Adobe with sources) has lesson with name "Requesting and retrieving XML data from the server".
0 Kudos
by Anonymous User
Not applicable
Original User: pthorstenson

Thank you for the response. I read through the provided links but was still not able to access a field from an xml file generated by the XML Workspace Document export tool. I finally went to tech support and they were able to help me with the correct answer. For those having a similar issue, the correct code is:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                          xmlns:s="library://ns.adobe.com/flex/spark"
                          xmlns:mx="library://ns.adobe.com/flex/mx"
                          creationComplete="myData.send();">
       <fx:Script>
               <![CDATA[
                       import mx.rpc.events.ResultEvent;

                       protected function myData_resultHandler(event:ResultEvent):void
                       {
                               // TODO Auto-generated method stub
                               myLabel.text = myData.lastResult.Data.Records[0].Record.Values.Value[19];

                                       //myList.dataProvider = myData.lastResult.Data.Records[2].Record.Values.Value[19];
                       }

               ]]>
       </fx:Script>

       <fx:Declarations>

               <s:HTTPService id="myData" url="C:\Users\shre6907\Desktop\parceltable.xml"
                                          resultFormat="e4x"
                                          result="myData_resultHandler(event)"/>
       </fx:Declarations>

       <s:Label id="myLabel" x="78" y="62" width="280" height="76"/>

       <!--mx:List id="myList" x="351" width="252" height="178">
       </mx:List-->

</s:Application>
0 Kudos