• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1877
  • Last Modified:

Results from HTTPService call to XMLList

I am trying to take the results (xml format) from an HTTPService call and create an XMLList from it so I can create an XMLListCollection from that to use to populate a tree component.  The tree component I am using has a custom built itemRenderer to put checkboxes to the left of the tree item.  But i keep getting an error when tryiong to convert to XMLList.  here is a portion of the code that handles the result from the httpservice

public function handleLocations(event:ResultEvent):void{
				this.t.text=event.result.top.toString();
				folderList = event.result.top as XMLList;
				
				folderCollection = new XMLListCollection(folderList);
				checkTree.dataProvider = folderCollection;
			}

Open in new window

0
jduawa
Asked:
jduawa
  • 2
1 Solution
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
Can you put forward what is returned from the HTTPService request?

0
 
jduawaAuthor Commented:
here is a portion of the XML that is generated by the http request


 <?xml version="1.0" encoding="UTF-8" ?> 
<top>
 <cl_state state="unchecked" label="Alabama" isBranch="true">
  <cl_city state="unchecked" isBranch="false" label="AUBURN" data="auburn" /> 
  <cl_city state="unchecked" isBranch="false" label="TUSCALOOSA" data="tuscaloosa" /> 
  <cl_city state="unchecked" isBranch="false" label="MONTGOMERY" data="montgomery" /> 
  <cl_city state="unchecked" isBranch="false" label="MOBILE" data="mobile" /> 
  <cl_city state="unchecked" isBranch="false" label="HUNTSVILLE" data="huntsville" /> 
  <cl_city state="unchecked" isBranch="false" label="BIRMINGHAM, AL" data="bham" /> 
  </cl_state>
 <cl_state state="unchecked" label="Alaska" isBranch="true">
  <cl_city state="unchecked" isBranch="false" label="ALASKA" data="anchorage" /> 
  </cl_state>
 <cl_state state="unchecked" label="Arizona" isBranch="true">
  <cl_city state="unchecked" isBranch="false" label="YUMA" data="yuma" /> 
  <cl_city state="unchecked" isBranch="false" label="PHOENIX" data="phoenix" /> 
  <cl_city state="unchecked" isBranch="false" label="PRESCOTT" data="prescott" /> 
  <cl_city state="unchecked" isBranch="false" label="FLAGSTAFF / SEDONA" data="flagstaff" /> 
  <cl_city state="unchecked" isBranch="false" label="TUCSON" data="tucson" /> 
  </cl_state>
...
</top>

Open in new window

0
 
jduawaAuthor Commented:
I am using the checktreerenederer from here, at least trying to
http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&postId=545&productId=2
0
 
Gary BenadeCommented:
Event.result is an XML object, so you are casting XML to XMLList which is illegal. Assuming folderList is an XMLList object, try changing your code to this:
public function handleLocations(event:ResultEvent):void
{
this.t.text=event.result.top.toString();
folderList =  XMLList( event.result.top);				
folderCollection = new XMLListCollection(folderList);
checkTree.dataProvider = folderCollection;
}

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now