Dienstag, 4. Oktober 2011

ActionScript HTTPService - a common error - Error #1090

If your application is quite fine but someday you get an error like this: Error #1090: XML parser failure: element is malformed
Then you might have just missed to explicitly set the resultformat to something different than the default which is xml in Flex 4.5.

So the snippet with the fix in the last line is:
var service: HTTPService = new HTTPService();
service.url = url;
// note: default seems to be xml. XML seems to work for most cases but crashes for exmaple if a json response contains the character '<'
service.resultFormat = "text";



For the folks that thought as I did for the first time - here a short reminder: Flex does not care about the correctly set response type of your reponse. You have to set it manually as seen above.

Keine Kommentare:

Kommentar veröffentlichen