Michael Kay <mike@saxonica.com> wrote on 09/15/2010 04:04:40 AM:
> The road to xs:anyURI was paved with good intentions. The XSD 1.0
> spec is notoriously vague about what validation rules should be
> applied to it (it contains the notorious phrase "This definition
> imposes only very modest obligations on ˇminimally conformingˇ
> processors", while failing to say clearly what those obligations
> are) and in consequence many implementations allow anything (or
> almost anything).
The spec also says that "anyURI is finite-length character sequences which, when the algorithm defined in Section 5.4 of [XML Linking Language] is applied to them, result in strings which are legal URIs ...". Once you apply those escaping rules from XLink you find that the class of strings which aren't in the lexical space of anyURI is quite small.
FWIW, Xerces does check anyURIs against the grammar for URI in the RFCs (after first applying the XLink escaping to the string).
> In XSD 1.1 the WG admitted defeat and changed the
> spec so the lexical space is exactly the same as xs:string. The
> XQuery and XSLT specifications also treat xs:anyURI more-or-less as
> equivalent to xs:string.
>
> So should you use xs:anyURI? Well, it provides a bit of
> documentation of your intent, and it might give you better bindings
> to data types in other languages. It has a bit more semantics than
> xs:string, though it's all very implicit. But the fact that
> something is present in a spec doesn't mean you have to use it.
>
> Michael Kay
Thanks.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org