I am defining an XSD. I need to define an element which takes date in format yyyymmdd. How can I define a restriction in XSD to only accept this format?
You could always define it as a restricted simple type based on a string, restricted by a regular expression:
If you want to get really smart, you can tweak the regular expression to be even more of a match for a date (e.g. contains the info that month can only be 01 - 12 and so forth):