XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Why Use anyURI

On 15/09/2010 1:35 AM, Heitke.Chris wrote:
360A1674FFC73B42BFD657060941DBF3146115E2@FG200201EVS.ftb.ca.gov" type="cite">

I have been asked what data type should be used for a website address element in a schema?

 

At first I thought the anyURI type would be appropriate. Maybe would insure the data is valid address.  Whereas the string type might not… problem is, validation tests show that the anyURI type allows virtually anything, just like the string type… So why use anyURI as a base data type? It does not appear to provide any greater assurance that the data will be better qualified than what would be gotten from a string?

 

Christopher A. Heitke

State of California, FTB

 


CONFIDENTIALITY NOTICE: This email from the State of California is for the sole use of the intended recipient and may contain confidential and privileged information. Any unauthorized review or use, including disclosure or distribution, is prohibited. If you are not the intended recipient, please contact the sender and destroy all copies of this email.

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). 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


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS