XSD date format overriding

后端 未结 2 1008
无人共我
无人共我 2021-01-03 00:47

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?

2条回答
  •  独厮守ぢ
    2021-01-03 01:26

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

    
       
           
       
    
    

    Marc

提交回复
热议问题