I have a problem with a dateTime element of my schema. It will not accept my dateTime pattern
cvc-pattern-valid: Value '18.11.2011 01:00:00.000' is not facet-valid with respect to pattern 'DD.MM.YYYY hh:mm:ss.SSS' for type 'DateTime'
If I remove the simpleType and just use dateTime as type on the element the following dateTime pattern is required and works: YYYY-MM-DDThh:mm:ss
I want to use the pattern DD.MM.YYYY hh:mm:ss.SSS. How can I configure that in my schema?
Before making a workable custom dataType, it is worth noting that xml is envelopping term including a wide range of interrelated technologies. If xs:dateTime is designed in a certain way to faciliate globalization/localization, it would be wise sometimes to work with it rather than against.
To achieve such special format which understandably inspired generally by a range of programming languages, it is advisable to transform it to the format conform to xs:dateTime in that programming language during the authoring time and consumming time. If the application (of certain language) is schema-aware, using xs:dateTime directly have further advantage of more effectivel data typing...
Having said, you can do a restriction based on xs:string (or some of its derived type such as normalizedString or tokens...)
This pattern is sort of coarse-grained: it can happily validate hours, minutes and seconds, days in range (01-31), months in range (01-12) and year in four digits.
But for date, it certainly is not quite enough, 28/30/31 day-month can more easily be accommodated by slight expansion of it. I leave it to you. But for leap year 29 day February, it is more cumbersome needing enumeration... It can be done for quite a few centuries without outrangeous inflated the pattern, but still it is unavoidably awkward in the look, though certainly not too difficult in practice.