What is the real difference between these resultformats for HTTPService in Flex :
text
object
xml
e4x
Especially, the last three seem pretty close to each other by their description.
What is the real difference between these resultformats for HTTPService in Flex :
text
object
xml
e4x
Especially, the last three seem pretty close to each other by their description.
The classtype of the returned object differs.
I recently had some issues with the "object" and "e4x" resultFormat
.
I have a base WebService Class that I use for sending requests and receiving results. By default, all results come back as "object". However, sometimes Flex looks at the data, and converts it to an appropriate type. For instance, if you have an XML result that looks like the following, it will convert it to an Array Object (not sure why...but...):
<root>
<child>text</child>
<child>text text</child>
</root>
Now, an Array Object like this can easily be cast as XML, since, as a string it is also XML.
However, some XML documents are returned as an ObjectProxy
, which cannot be cast as XML, when the resultFormat
is "object".
I tried using "e4x", as it was suggested here, but then I ran into problems with namespaces not being preserved correctly.
I finally tried "xml", and I am getting the expected results. It's interesting that when you inspect the event result property using the Flex Debugger, it is said to be an Array, even when you specify a resultFormat
of "xml". I guess this allows for easily casting to ArrayCollection...not sure....