[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Why Use anyURI

  • From: Michael Kay <mike@saxonica.com>
  • To: xml-dev@lists.xml.org
  • Date: Wed, 15 Sep 2010 09:04:40 +0100

Re:  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

  • References:

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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.