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

ANN: an XML Schema simpleType for UUIDs with no encoded information

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Sat, 6 Mar 2010 10:58:20 -0500

ANN: an XML Schema simpleType for UUIDs with no encoded information
Hi Folks,

 UUIDs are often used as unique identifiers. Here's an example usage:


The value of <Book-ID> is a UUID.

 UUID'shave this format:


That is, 8 hexadecimal digits, dash, 4 hexadecimal digits, dash, etc.

There are five versions of UUIDs. I describe two:

1. One version encodes into the UUID the timestamp of when the UUID was encoded and the network address of the machine that created the UUID. 

2. There is another version of UUID where all the hexadecimal digits are random.  

Below I describe how to create an XML Schema simpleType for the random-digit version UUID. 

The 13th hexadecimal digit in a UUID specifies the "version." 

   - A value of 1 means this version encodes into the UUID the 
     timestamp and network node address. 

   - A value of 4 means all the hexadecimal digits in the UUID are all random. 

The two most significant bits of the 17th hexadecimal digit indicates the "variant" of the UUID. 

   - One variant indicates that the UUID is a Microsoft UUID. 

   - By setting the two bits to 10 you indicate that the UUID 
     complies with RFC 4122. That's what we want. Thus, the 
    values we want to allow for the 17th hexadecimal digit are: 
    1000, 1001, 1010, 1011 (8 - 11, or, in hex, 8 - b, or 8 - B).

Here is an XML Schema simpleType that captures that analysis:

    <xs:simpleType name="UUID-random">
        <xs:restriction base="xs:string">
            <xs:length value="36" fixed="true" />
            <xs:pattern value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[8-9a-bA-B][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" fixed="true" />


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


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.
First Name
Last Name
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.