• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

dateTime pattern problem in schema

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 734
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic