Total members 11889 |It is currently Thu Mar 28, 2024 11:02 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Define UUID in XSD schema :
You can use pattern restriction to define UUID as a type in your XSD schema. For example :
Code:
<element name="UUIDType"  >
                <simpleType>
                    <restriction base="ID">
                        <pattern
                            value
="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}">
                        </pattern>
                    </restriction>
                </simpleType>
            </element>


This XSD snippet defines an XML element called "UUIDType" with a simple type consisting of a restriction of the ID data type. The restriction has a pattern value of "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}". This means that the "UUIDType" element must contain a string value that matches the given pattern. The pattern is a regular expression that defines a specific format for a UUID (Universally Unique Identifier). It must be composed of 8 hexadecimal characters, followed by a hyphen, then four more hexadecimal characters, another hyphen, then four more hexadecimal characters, another hyphen, then four more hexadecimal characters, and finally 12 more hexadecimal characters. This XSD snippet can be used to validate XML documents to ensure that the "UUIDType" element contains a valid UUID value.

This XSD snippet only defines the structure of the "UUIDType" element, it doesn't specify any rules or constraints on how many times the element can occur, where it can occur in the XML document, or what elements can come before or after it. If you want to specify these kind of rules, you would need to include the "UUIDType" element in a larger XSD schema that defines the overall structure of the XML document. Also, this XSD snippet only defines the pattern for the UUID, it does not check if the value is unique or not, if you need to check the uniqueness, you can create a complex type to validate it.


UUID contains five sets of hexadecimal numbers.



_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : define UUID in your XSD schema
 UUID as key     -  
 lesson1 : <schema> Element     -  
 Define statement     -  
 Define new namespaces in C++     -  
 Define template in C++     -  
 how to Define abstract class in php     -  
 Define your own exception class     -  
 define a Class with a Method     -  
 define final class     -  
 Define enum in java     -  



Topic Tags

XSD Elements
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com