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

<Book-Request>
    <Book-ID>4655eb25-e5c8-435a-b0ea-7460d8f28cce</Book-ID>
</Book-Request>

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

 UUID'shave this format:

    8-4-4-4-12

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" />
        </xs:restriction>
    </xs:simpleType>

/Roger


[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