XHR: sending documents

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

XHR: sending documents

Bjoern Hoehrmann

Hi,

  For send(Document) the draft says

  data must be serialized into a namespace well-formed XML document and
  encoded using the encoding given by data.xmlEncoding (the XML
  declaration), if specified, or UTF-8 otherwise. The serialization must
  include an XML declaration when the final encoding is not UTF-8 or
  UTF-16.

I would suggest to remove "(the XML declaration)" since xmlEncoding is
not the XML declaration, and turning it into e.g. "(as derived from the
XML declaration)" is unnecessarily long. The last sentence is not really
appropriate for XML documents, first the requirement is essentially im-
plied by the requirement that the result must be namespace well-formed,
and there are other cases where the XML declaration is required, e.g. if
the Document is an XML 1.1 document. I would suggest to remove this, or
turn it into a non-normative note clearly indicating that this is just
one of many requirements.

I think there needs to be a node clearly stating that even if you try
to send a HTMLDocument, it will be serialized as if it were XML.

It might also be worth to note that on sending, the implementation takes
a snapshot of the document and subsequent modifications of the Document
during async upload are not reflected in the result.

The main flaw here however is that it may not be possible to meet the
requirement to create a ns well-formed document, for example, if it
contains a processing instruction whose data includes "?>"; it is not
possible to represent such a Document as an XML document. The draft has
to address this case.
--
Björn Höhrmann · mailto:[hidden email] · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Reply | Threaded
Open this post in threaded view
|

Re: XHR: sending documents

Robin Berjon-2

On Feb 22, 2007, at 09:50, Bjoern Hoehrmann wrote:

> I would suggest to remove "(the XML declaration)" since xmlEncoding is
> not the XML declaration, and turning it into e.g. "(as derived from  
> the
> XML declaration)" is unnecessarily long. The last sentence is not  
> really
> appropriate for XML documents, first the requirement is essentially  
> im-
> plied by the requirement that the result must be namespace well-
> formed,
> and there are other cases where the XML declaration is required,  
> e.g. if
> the Document is an XML 1.1 document. I would suggest to remove  
> this, or
> turn it into a non-normative note clearly indicating that this is just
> one of many requirements.

+1 to removing it.

> I think there needs to be a node clearly stating that even if you try
> to send a HTMLDocument, it will be serialized as if it were XML.

Agreed. Does the XHTML namespace get added automagically?

> It might also be worth to note that on sending, the implementation  
> takes
> a snapshot of the document and subsequent modifications of the  
> Document
> during async upload are not reflected in the result.

Yes, that will certainly alleviate some confusion from users who  
think XML == DB.

> The main flaw here however is that it may not be possible to meet the
> requirement to create a ns well-formed document, for example, if it
> contains a processing instruction whose data includes "?>"; it is not
> possible to represent such a Document as an XML document. The draft  
> has
> to address this case.

I can't think of anything useful that the UA can do on its own there,  
I'd suggest throwing an exception (DOMError or some such).

--
Robin Berjon - http://berjon.com/
------------------------------------------------------------------------
RDF is like violence: if it doesn't work, use more!



Reply | Threaded
Open this post in threaded view
|

Re: XHR: sending documents

Alexey Proskuryakov

On 2/26/07 5:29 PM, "Robin Berjon" <[hidden email]> wrote:

>> I think there needs to be a node clearly stating that even if you try
>> to send a HTMLDocument, it will be serialized as if it were XML.
>
> Agreed. Does the XHTML namespace get added automagically?

  It is not added by Firefox or Opera. I guess it would be of little use
with uppercase HTML tags.

- WBR, Alexey Proskuryakov



Reply | Threaded
Open this post in threaded view
|

Re: XHR: sending documents

Anne van Kesteren-2
In reply to this post by Robin Berjon-2

On Mon, 26 Feb 2007 15:29:14 +0100, Robin Berjon <[hidden email]> wrote:

>> I would suggest to remove "(the XML declaration)" since xmlEncoding is
>> not the XML declaration, and turning it into e.g. "(as derived from the
>> XML declaration)" is unnecessarily long. The last sentence is not really
>> appropriate for XML documents, first the requirement is essentially im-
>> plied by the requirement that the result must be namespace well-formed,
>> and there are other cases where the XML declaration is required, e.g. if
>> the Document is an XML 1.1 document. I would suggest to remove this, or
>> turn it into a non-normative note clearly indicating that this is just
>> one of many requirements.
>
> +1 to removing it.

This should be addressed.


>> I think there needs to be a node clearly stating that even if you try
>> to send a HTMLDocument, it will be serialized as if it were XML.
>
> Agreed. Does the XHTML namespace get added automagically?

I rather wait with this until HTML5 is there. Although I suppose we could  
add some non-normative text hinting in that direction.


>> It might also be worth to note that on sending, the implementation takes
>> a snapshot of the document and subsequent modifications of the Document
>> during async upload are not reflected in the result.
>
> Yes, that will certainly alleviate some confusion from users who think  
> XML == DB.

This is also fixed.


>> The main flaw here however is that it may not be possible to meet the
>> requirement to create a ns well-formed document, for example, if it
>> contains a processing instruction whose data includes "?>"; it is not
>> possible to represent such a Document as an XML document. The draft has
>> to address this case.
>
> I can't think of anything useful that the UA can do on its own there,  
> I'd suggest throwing an exception (DOMError or some such).

Has anyone tested what implementations do?


--
Anne van Kesteren
<http://annevankesteren.nl/>
<http://www.opera.com/>