These day I’ve been fighting with this issue: trying to get the Flexer XML feed from FeedBurner into a Flex application. As many of you may know FeedBurner serves the XML with an XSL and browsers that know XSL will parse it and display it in a nicer way that a simple xml.
The problem is that I use IE 7 for development and debugging which is not the best thing to do. So I did a small application to read a feed from an specified URL.
At run-time in IE I always got this error (is displayed after clicking on Get HTTPService button with format=”xml” unchecked – ONLY IN IE) :
Error #1085: The element type “link” must be terminated by the matching end-tag “</link>”.
When I did look in the message.body property of the fault event I was shocked to see that what I get is a HTML page – NOT an XML one. HTML pages do have tags that do not close like “link” tag used to add CSS to the page.
I tried every property of HTTP service, some headers and content types, I also made a URLRequest approach but the same thing.
In the other browser the things were different. Everything was OK. I was requesting for an XML I got an XML. That is great! But I still need to make it work in IE.
It seems that IE is different… It parses everything before sending it to the flash player. I’m not a hundred percent sure if is correct what I am saying but that is how I explained it. Then a “brilliant” colleague of mine found the needed thing – in the request add format = “xml” as request. It seems that when format = “xml” is set FeedBurner sends another header back to IE browser which will tell the browser not to parse the XML with XSL. So, I did it like below (starting with line 11 in the whole code):
testGetUrl.send((useFormat.selected ? {format:'xml'} : {}))
Notice {format:”xml”} object which holds our request parameter.
Here is the whole code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="370" height="310"> <mx:HTTPService id="testGetUrl" fault="handleFault(event)" result="handleResult(event)" resultFormat="e4x" url="{geturl.text}"> </mx:HTTPService> <mx:Button x="10" y="40" label="Get HTTPService" click="testGetUrl.send( (useFormat.selected ? {format:'xml'} : {}) )"/> <mx:Button x="137" y="40" label="Get URLRequest" click="handleGetUrlRequest(event)"/> <mx:CheckBox id="useFormat" x="10" y="70" label="Use format="xml""/> <mx:TextInput id="geturl" x="10" y="10" width="350" text="http://feeds.feedburner.com/flexer/"/> <mx:TextArea id="geturlresp" x="10" y="96" width="350" height="204"/> <mx:Script> <![CDATA[ import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; private function handleFault(e:FaultEvent):void { var temp:String = e.fault.faultString.toString() + "\n\n" + e.message.body.toString(); geturlresp.text = "HTTPSERVICE FAULT!\n\n" + temp; } private function handleResult(e:ResultEvent):void { var temp:* = e.result; geturlresp.text = "HTTPSERVICE RESULT!\n\n" + e.result.toString(); } private function handleGetUrlRequest(e:MouseEvent):void { var urlReq:URLRequest = new URLRequest(geturl.text + (useFormat.selected ? "/?format=xml" : "")); urlReq.method = URLRequestMethod.GET; var urlLoader:URLLoader = new URLLoader(urlReq); urlLoader.addEventListener( Event.COMPLETE, handleUrlRequestComplete); } private function handleUrlRequestComplete(e:Event):void { var tmp:* = e.currentTarget.data; geturlresp.text = "URLREQUEST COMPLETE!\n\n" + tmp.toString(); } ]]> </mx:Script> </mx:Application> |
I made also a URLRequest option so you can see that is something that is not happening only when using HTTPService.
Again… I want to specify that the error appears only on IE.
We may write new articles on this as we will found more about it.
So keep reading us.
Tags: feed, feedburner, xml, xsl
This post was written by Andrei Ionescu
Views: 5552










I usually don’t post comments on a blog. But I must admit that this god damn IE xml request haunted me for a few days now till I finally ran across ur blog.
Thx for ur colleague for pointing out the solution and thank you for posting it.
Please oh please oh please tell me if there is a way to translate this to AS3. I am banging my head against a wall with this, and this is the closest I’ve come to a solution, but I don’t use Flex.
OK, I worked it out for AS3. So simple! You just add the /?format=xml to the end of the feedburner url. I seriously couldn’t have worked it out without this blog post. Thanks a ton.