W3C home > Mailing lists > Public > public-expath@w3.org > July 2012

Re: [expath] EXPath File Module, Update

From: Christian Grün <christian.gruen@gmail.com>
Date: Thu, 19 Jul 2012 14:53:51 +0200
Message-ID: <CAP94bnO_o+srq=67wcg+_Y7frmJfEf0XM1A6jMbM_Gw_q53Mhg@mail.gmail.com>
To: expath@googlegroups.com
Cc: public-expath@w3.org
I would tend to simplify the rules and treat "write" and "append" the
same way, such that “a BOM will [only] be written if the serialization
parameter byte-order-mark is present with the value "yes" and the
(explicit or implicit) encoding is one in which BOM is encodable.”.

We could as well make the rule implementation defined, as this would
be closer to the serialization specification: “[…] this specification
does not mandate the byte-order-mark parameter to have the value yes
when the encoding is UTF-16 […]” [1].

What do you think?
Christian

[1] http://www.w3.org/TR/xslt-xquery-serialization-30/#XML_BYTE-ORDER-MARK
___________________________

On Thu, Jul 19, 2012 at 9:47 AM, Michael Kay <mike@saxonica.com> wrote:
>
> OK, so that suggests the rule:
>
> * file:append#2 does not write a BOM
>
> * file:append#3 writes a BOM if the serialization parameter byte-order-mark
> is present with the value "yes" and the (explicit or implicit) encoding is
> one in which BOM is encodable (even if the file is non-empty before the
> append)
>
> * file:append-text#2 does not write a BOM
>
> * file:append-text#3 does not write a BOM
>
> * file:append-text-lines#2 does not write a BOM
>
> * file:append-text-lines#3 does not write a BOM
>
> * file:append-binary#2 does not write a BOM
>
> * file:write#2 does not write a BOM
>
> * file:write#3 writes a BOM if the serialization parameter byte-order-mark
> is present with the value "yes" and the (explicit or implicit) encoding is
> one in which BOM is encodable, or if the serialization parameter
> byte-order-mark is absent and the encoding is UTF-16 or a variant thereof.
>
> * file:write-text#2 does not write a BOM
>
> * file:write-text#3 writes a BOM if the encoding is UTF-16 or a variant
> thereof
>
> * file:write-text-lines#2 does not write a BOM
>
> * file:write-text-lines#3 writes a BOM if the encoding is UTF-16 or a
> variant thereof
>
> * file:write-binary#2 does not write a BOM
>
> Does that sound OK?
>
> Michael Kay
> Saxonica
>
>
>
>
>
>
>
> On 19/07/2012 00:46, Christian Grün wrote:
>>
>> Hi Michael,
>>
>>>>> I've just returned to my uncompleted implementation and test suite for
>>>>> this module (the test suite is a lot more work than the
>>>>> implementation...).
>>>>
>>>> Would you be willing to share some of your tests?
>>>
>>> Yes, I'll be very happy to do that.
>>
>> Great; thanks in advance.
>>
>>
>>>>> I'm hitting problems knowing what to do about BOMs. Under what
>>>>> circumstances should a BOM be written?
>>>
>>> […] Java seems to be writing BOMs every time the file is opened
>>> for append access, which is messy.
>>
>> In our current implementation, BOMs will only be written if they are
>> explicitly specified via serialization parameters; e.g.:
>>
>> Q{http://expath.org/ns/file}append('out', <日/>,
>>    <serialization-parameters
>> xmlns='http://www.w3.org/2010/xslt-xquery-serialization'>
>>      <byte-order-mark value='yes'/>
>>    </serialization-parameters>)
>>
>> If this query is executed several times, the BOM will be written more
>> than once, too.
>>
>> Hope this helps,
>> Christian
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "EXPath" group.
> To post to this group, send email to expath@googlegroups.com.
> To unsubscribe from this group, send email to
> expath+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/expath?hl=en.
>
Received on Thursday, 19 July 2012 12:54:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 19 July 2012 12:54:52 GMT