]>

Introduction

This schema document describes a [draft] component of the XML Schema type library: datatypes for URIs as defined by RFC 3986.

The types defined here check the conformance of literal strings against the regular expression given in Appendix A of RFC 3986, translated into XSD notation. See also the schema document for IRIs located in the same directory as this document.

Please send suggestions for improvements to www-xml-schema-comments@w3.org. Mention the URI of this document: http://www.w3.org/2011/04/XMLSchema/TypeLibrary-URI-3986.xsd

See below (at the bottom of this document) for information about the revision and namespace-versioning policy governing this schema document.

RFC 3986 says:

A URI is an identifier consisting of a sequence of characters matching the syntax rule named <URI> in Section 3. It enables uniform identification of resources via a separately defined extensible set of naming schemes (Section 3.1). How that identification is accomplished, assigned, or enabled is delegated to each scheme specification.

The URI-3986 type checks the string against the regex grammar for URI in RFC 3986 Appendix A. (The regex in Appendix B would be simpler, but it accepts any string of Basic Latin characters, whether they satisfy the grammar for URIs or not. So for validation, it's useless.)

Note that the grammar for URI is essentially the same as that for absolute URIs, with the addition of an optional hash mark (#) and fragment identifier:

	    URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
	  

The absolute-URI-3986 type checks the string against the regex grammar for absolute URIs in RFC 3986 Appendix A.

The grammar is very like that for URI, but it does not allow a fragment identifier.

The relative-reference-3986 type checks the string against the regex grammar for relative references in RFC 3986 Appendix A.

The top-level rules in the grammar are:

	    relative-ref  = relative-part [ "?" query ] [ "#" fragment ]

	    relative-part = "//" authority path-abempty
                          / path-absolute
                          / path-noscheme
                          / path-empty
	  

The URI-reference-3986 type checks the string against the regex grammar for URI references in RFC 3986 Appendix A. This is the one most users are likely to say they want when they are looking for a generic URI type and have thought about it for a bit. But it's not: what they are most likely to want in reality is the IRI-reference type defined in the schema document for IRIs, in this directory.

The rule in the grammar is:

          URI-reference = URI / relative-ref
        

Rather than write this as a single pattern, however, we will just take a union of the two types already defined.

To-do list

  • Make similar types for the earlier versions of the URI spec: RFC 2396, 2732, 1808, 1738. Use these to make a union type for all forms of URI references (for example) accepted by any RFC definition of URI or URL.

  • Make tighter patterns for at least some specific URI schemes that have tighter grammars, as an illustration. The number of registered schemes is probably too high for it to be feasible or reasonable to cover more than a few of them, but there are certainly specific schemes it would be helpful to be able to validate more tightly: for example, mailto, doi, data, dict, dns, fax, file, imap, mid, news, nntp, pop, pres, im, sms, tag, some forms of URN, z39.50, feed, git, irc, jar, mvn, rsync, ssh, smb, svn.

Versioning policy for this document

$Id: TypeLibrary-URI-RFC3986.xsd,v 1.14 2011/05/03 01:51:32 cmsmcq Exp $

In keeping with the XML Schema WG's standard versioning policy, this schema document will persist at http://www.w3.org/2011/04/TypeLibrary-URI-RFC3986.xsd.

At the date of issue it can also be found at http://www.w3.org/2001/03/XMLSchema/URI-3986.xsd. The schema document at that URI may however change in the future, in order to remain compatible with the latest version of XML Schema itself. In other words, if the XML Schema namespace changes, the version of this document at http://www.w3.org/2001/03/XMLSchema/TypeLibrary-URI-3986.xsd will change accordingly; the version at http://www.w3.org/2011/04/TypeLibrary-URI-3986.xsd will not change.

Previous dated (and unchanging) versions of this schema document include:

  • [None]