Re: [expath] EXPath File Module, Update

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
>

Received on Thursday, 19 July 2012 07:48:11 UTC