Re: Comment on "Allow both xs:base64Binary and xs:hexBinary as arguments"

On 4 Jul 2013 16:07, "Jirka Kosek" <jirka@kosek.cz> wrote:
>
> On 4.7.2013 14:54, Florent Georges wrote:
>
> >   Yes, it would be preference as well if we go that way (using
> > xs:anyAtomicType in the signature of the functions in the API).
> >
> >   So in that case, the return type has to be xs:anyAtomicType as well,
> > to be able to return the same type as received as parameter.
>
> No, return value for binary values has to be either base64Binary or
> hexBinary, otherwise it will raise dynamic error when passed as binary
> argument to another function.

My feeling is that we are trying to be too clever by far!
I think a simple approach usually wins and is much more sensible here. I
propose -

Functions should explicitly take xs:base64binary and return xs:base64binary
because that is the type used in other EXPath specs.

What if you want xs:hexBinary? Simply, we provide conversion functions
to/from hex to base64.

This approach is unlikely to have any implementation overhead as more that
likely implementations keep this data in raw bytes until serialization time
anyway.

Or if you really insist on all functions handling xs:hexBinary, we can have
two of every function, with slightly different names, one takes
base64binary args and the other takes hexBinary. But I think this is
overkill.

IMHO trying to do some unholy matrimony of base64binary and hexBinary types
outside of the XQuery spec itself is undesirable, beyond the scope of
EXPath and fraught with issues.

>                                 Jirka
>
> --
> ------------------------------------------------------------------
>   Jirka Kosek      e-mail: jirka@kosek.cz      http://xmlguru.cz
> ------------------------------------------------------------------
>        Professional XML consulting and training services
>   DocBook customization, custom XSLT/XSL-FO document processing
> ------------------------------------------------------------------
>  OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
> ------------------------------------------------------------------
>     Bringing you XML Prague conference    http://xmlprague.cz
> ------------------------------------------------------------------
>

Received on Thursday, 4 July 2013 15:36:01 UTC