XmlHttpRequest and DOM 3 LS

There is to be lots of confusing between XmlHttpRequest and DOM 3 LS
nowadays, especially with the emergence of "Ajax". It seems it's worth
an entry in the DOM FAQ to clarify the differences.
Something along:
[[
DOM3 LS defines the LSParser [1] and LSSerializer [2] interfaces.
XmlHttpRequest was introduced in Internet Explorer. DOM 3 LS that do
provide synchronous and synchronous loading of the DOM tree as well as
saving capabilities but, unless the XmlHttpRequest object, without
control over the HTTP protocol (no user/passwd, no HTTP header, etc.).
DOM 3 LS provides other functionalities such as a better control over
the DOM tree being built or saved using the parameters and the filtering
mechanisms. The LSInputSource and LSOutputSource object provide also
better flexibility.
]]

Now, here is a proposal to add the missing functionality in DOM 3 LS: 

interface HTTPRequest {
  String passwd;
  String user;
  void setHTTPHeader(String header, String value);
}

Add a new DOMConfiguration parameter:
"http-request"
  [optional]
  A reference to a HTTPRequest object, or null. If the value of this
parameter is not null, the implementation will use it if a resource is
retrieved using the HTTP transport protocol.

The parameter is supported on LSParser.config and LSSerializer.config.
It has the limitation of being used for all resources being retrieved,
ie you can't change depending on the external entity being loading from
the same document. There is probably a security issue with user/passwd,
should they either be restricted to the domain of the root document
being retrieved?

then, to access the HTTP headers of the response:

interface HTTPResponse {
  int status;
  String getHTTPHeader(String value);
}

Add a new DOMConfiguration parameter:
"http-response"
 [optional]
 A reference to a HTTPResponse object, or null. If the value of this
parameter is not null, it contains the returned status code and http
headers provided during the retrieval of the root document using the
HTTP transport protocol.

The parameter is supported on Document.config.

Philippe
[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/7924f6be-c035-411f-acd2-79de7a711b38.asp

Received on Thursday, 19 May 2005 18:38:38 UTC