W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2006

[whatwg] XMLHttpRequest.responseXML and invalid XML documents

From: Hallvord Reiar Michaelsen Steen <hallvord@hallvord.com>
Date: Tue, 31 Jan 2006 14:34:44 +0900
Message-ID: <43DF7584.4992.38730380@hallvord.hallvord.com>
On 25 Jan 2006 at 20:54, Hallvord Reiar Michaelsen Ste wrote:

> > Spec says about responseXML : 
> > > If the document was not an XML document, or if the document could
> > > not be parsed (due to an XML well-formedness error or unsupported
> > > character encoding, for instance), returns null.

All UAs I test in ignore an unknown character encoding value and 
parses the document anyway. I'm not sure if the sentence above is 
meant to distinguish between charset="bogus-charset" and charset="utf-
64" (in other words, a charset the UA might be aware that it doesn't 
support - as opposed to a completely uknown one).

Suggest removing the unsupported character encoding statement from 
this sentence. The spec should say that when an unknown character 
encoding is used the UA should assume UTF-8 and move on with parsing.

This is what Opera and FireFox do (consistently) and what IE does but 
only for responseText. IE creates an empty responseXML document if 
charset is unknown.

Currently the spec says only text/xml, application/xml or content-
types ending with +xml will cause the UA to create a responseXML 
document. I suggest this should also apply to text/html if the 
document is wellformed. This is implemented in Opera.

Proposed new text:

   <dd>If the <code title="XMLHttpRequest.readyState"><a
    href="#readystate">readyState</a></code> attribute has a value other than
    4 (Loaded), returns null. Otherwise, if the <code>Content-Type</code>
    header is either <code>text/html</code>, <code>text/xml</code>, 
    <code>application/xml</code>, or ends in <code>+xml</code>,
    returns an object that implements the Document interface
    representing the parsed document. If the document was not an
    XML document, or if the document could not be parsed (due to an XML
    well-formedness error, for instance), returns an empty document.</dd>

-- 
Hallvord Reiar Michaelsen Steen
http://www.hallvord.com/
Received on Monday, 30 January 2006 21:34:44 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:44 UTC