Re: XMLHttpRequest.responseXML returning null for non-XML MIME types

Just to be clear, the widget loads a local file. Technically, the spec  
only covers HTTP loads, so it doesn't de facto require breaking this  
widget.

Geoff

On Jun 29, 2007, at 1:34 PM, Geoffrey Garen wrote:

> Hi folks.
>
> The XMLHttpRequest spec says that, if an HTTP response contains a  
> content-type header that is not XML, XMLHttpRequest .responseXML  
> should return NULL (http://www.w3.org/TR/XMLHttpRequest/#xml-response-entity-body 
> ).
>
> I'm looking into this issue because it has broken a widget on Mac OS  
> X. The widget uses XMLHttpRequest to load a valid XML file and then  
> read responseXML. Unfortunately, the file comes to use with an  
> incorrect MIME type (application/octet-stream), so we return NULL  
> and later throw an exception.
>
> To me, it seems preferable to try to parse the response as XML,  
> returning NULL only if parsing fails. The spec already says you  
> should do this if the content-type header is missing. Why not do it  
> always?
>
> Thanks,
> Geoff

Received on Friday, 29 June 2007 21:10:27 UTC