W3C home > Mailing lists > Public > public-webapi@w3.org > April 2006

XMLHttpRequest.responseXML and invalid XML documents

From: Hallvord R. M. Steen <hallvord@opera.com>
Date: Fri, 21 Apr 2006 19:03:21 +0200
To: public-webapi@w3.org
Message-ID: <op.s8dazvgsa3v5gv@id-c0418.oslo.opera.com>

I've been asked to re-post some things I sent to the WHATWG list regarding  

Originally posted to

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 major browsers return an empty document instead under most of
these conditions.


- FireFox *does* return null if the document is sent as text/html
- FireFox and Opera guess UTF-8 encoding if the encoding sent from
the server is unknown, and parses document.

Requiring that browsers return null may not be compatible with
existing content. Scripts that today use for example
would fail with an error if responseXML was null, and today there is
virtually no point of saying "if(x.responseXML)" first since it will
nearly always be a document object so no scripts will be written that
way. Could we standardise returning an empty document instead, for
all these conditions?

Hallvord R. M. Steen
Core QA JavaScript tester, Opera Software
Opera - simply the best Internet experience
Received on Monday, 24 April 2006 02:34:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:16:21 UTC