I assume the missing <order> root tag is just a typo.

 

Well, make sure you are getting xml first try:

srv.lastResult.toXMLString();

then start working your way down the tree.

 

Since there are multiple items, srv.lastResult.order.item.(@amount) is going to return an ArrayList.  You probably cannot put that into a text property.

 

I suggest using a result handler instead of binding.  It is easier to debug.

 

Tracy

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of rama satoskar
Sent: Friday, June 16, 2006 7:50 AM
To: [email protected]
Subject: [flexcoders] importing xml data using httpservice!

 

Hi all,
Yesterday i had posted a query abt importing xml data using the
HTTPService. Here is the sample code. I am unable to view the dat in
the external file into the text area. Is there a problem with the code.

test.xml
-----------
<order amount=5>
<item id = "3456">
<description>Big Screen Television</description>
<price>1299.99</price>
<quantity>1</quantity>
</item>
<item id = "56789">
<description>DVD Player</description>
<price>399.99</price>
<quantity>1</quantity>
</item>
</order>

myApp.mxml
-------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="srv.send();">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
]]>
</mx:Script>
<mx:HTTPService id="srv" resultFormat ="e4x" url="">xml"/>
<mx:TextInput id="gettxt"
dtext="{srv.lastResult.order.item.(@amount)}" width="348" height="207"/>
</mx:Application>

I have even tried changing the resultFormat by changing it from null
to e4x to xml. nuthing worked.I want to display the value of the
'amount' attribute in the textInput box.

My application suppose needs to convert the data from the external xml
file into a local XML object how can i do that? I know there is
XMLNode and XML type data objects available. however i dont understand
how to copy the data of the external file into an XML object.

Kindly help,
Rama.
Thanks in advance.

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to