[Greasemonkey] Re: responseXML for GM_xmlhttpRequest
lists at atrus.org
Fri Jul 8 03:26:15 EDT 2005
Lenny Domnitser wrote:
>> I seem to remember someone (*poke, Mark*) declaring text/xml
>>officially evil. But maybe we should actually use the response type?
>>Cuz you know, hard-coding a mime type feels dirty to me.
>That is what I thought should be done. I used text/xml because I read
>in a comment in some Mozilla code that it is to be parsed as text/xml
>, but on inspection of code in a separate source file, it is only
>parsed as text/xml if no content type is sent .
>I'm not sure if GM should follow Mozilla's code exactly or instead use
>application/xml if no content type is provided. Using text/xml instead
>of application/xml might be a bug in Mozilla (somebody check RFC 3023,
>as I will not wade through that whole thing now). GM should probably
>mirror Mozilla's default content type, and if it ever changes, follow
>[RFC 3023]: http://www.ietf.org/rfc/rfc3023.txt
All that matters is that it's one of the content types that DOMParser
handles. If you try to parse a type that it doesn't handle, it will
throw a NOT_IMPLEMENTED error. It's entirely internal, so I see no
reason to worry about standard default content types. The only reason to
change it would be if the parser stopped accepting text/xml, and I don't
think that's happening. They assume an XML type because it's XMLHttpRequest.
I'll note that DOMParser DOES NOT handle HTML. Period. Adding HTML
parsing is non-trivial at the moment because of details in the way HTML
parsing is done. Boris Zbarsky sums up the situation nicely in a google
More information about the Greasemonkey