[xquery-talk] When to us xs:string or xs:anyURI ?

Michael Kay mike at saxonica.com
Wed Apr 17 02:37:13 PDT 2019


In the standard function library we adopted the approach that for input parameters, relevant functions should accept xs:string; for function results, they should return an xs:anyURI. That recognizes the one-way casting effect.

xs:anyURI is a bit of a mess. XQuery supports it only because it already existed in XSD.

Michael Kay
Saxonica

> On 17 Apr 2019, at 03:24, Andreas Mixich <mixich.andreas at gmail.com> wrote:
> 
> Hello,
> 
> I wonder, what dis/advantages it would have to use the xs:anyURI
> datatype for IRIs
> instead of xs:string. Looking around, it seems, that most people do not
> care for
> the xs:anyURI and use xs:string instead, since that is easier to handle
> (type casting works only one-directional with xs:anyURI).
> 
> What was the rationale behind creating an xs:anyURI datatype?
> According to http://www.datypic.com/sc/xsd/t-xsd_anyURI.html
> 
>   [...]The only values that are not accepted are ones that make
> inappropriate
>   use of reserved characters, such as ones that contain
> multiple |#| characters
>   or have |%| characters that are not followed by two hexadecimal
> digits.[...]
> 
> As XQuery users, what would you prefer in a module library for
> functions, that take
> or return IRIs? What would you expect in a module library, that acts as
> a "swiss army
> knife" for IRIs?
> 
> -- 
> Goody Bye, Minden jót, Mit freundlichen Grüßen,
> Andreas Mixich
> 
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk




More information about the talk mailing list