W3C home > Mailing lists > Public > public-webapi@w3.org > June 2007

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

From: Geoffrey Garen <ggaren@apple.com>
Date: Fri, 29 Jun 2007 14:10:20 -0700
Cc: public-webapi@w3.org
Message-Id: <79FF16D5-2661-47A0-986C-FAEE7B838B59@apple.com>
To: Geoffrey Garen <ggaren@apple.com>

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:18:57 GMT