I'm trying to make a contact list in a DataGrid and I get my XML file from GoldMine.
Here is a sample of the XML
<gmdata>
<accounts>
<account gm_recid="JDFUHEF$1&REDFV" gm_accountno="A652451337%U<{6UBbg" >
<properties>
<property name="Address1" db_name="ADDRESS1" >
<property_string>555 State St.</property_string>
</property>
<property name="Address2" db_name="ADDRESS2" >
<property_string>Room B</property_string>
</property>
<property name="ASSN" db_name="COMPANY" >
<property_string>Company</property_string>
</property>
<property name="City" db_name="CITY" >
<property_string>Cincinnati</property_string>
</property>
<property name="State" db_name="STATE" >
<property_string>OH</property_string>
</property>
<property name="Zip" db_name="ZIP" >
<property_string>55555</property_string>
</property>
</properties>
</account></accounts>
</gmdata>
Here is my mxml:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
initialize="assocService.send()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]
private var assocData:ArrayCollection;
private function resultHandler(event:ResultEvent):void {
assocData = event.result.gmdata.accounts.account.properties;
}
]]>
</mx:Script>
<mx:HTTPService id="assocService"
url="data/associations.xml"
result="resultHandler(event)" />
<mx:DataGrid dataProvider="{assocData}" />
</mx:Application>
It compiles fine, and I get this error when the browser tried to load the page.
I'm trying to figure out how to get the data out correctly.
I'd like the information displayed something like this:
Address1 | Address2 | ASSN | City | State | Zip |
---|---|---|---|---|---|
555 State St. | Room B | Company | Cincinnati | OH | 55555 |
I'm not sure how my assocData variable in the resultHandler function should be set.
private function resultHandler(event:ResultEvent):void {
assocData = event.result.gmdata.accounts.account.properties;
}
I tried this as well, with the same error:
private function resultHandler(event:ResultEvent):void {
assocData = event.result.gmdata.accounts.account.properties.property;
}
Is there a way to handle the name attribute in the property tag then grab the info from the property_string tag?
Views
Replies
Total Likes
The
& nbsp;
are not really in the code, that is this forum doing that.
Views
Replies
Total Likes
1) Your data has a & in it, and Flex won't parse that. Maybe use &
2) You don't have any columns in your data grid.
3) You should use XMLListCollection and specify e4x as the HTTPService resultFormat.