In the xml schema data type –> date allows date as yyyy-mm-dd format by default.
How can we modify it so that it accepts yyyy/mm/dd format style instead ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t get the standard xs:date type to accept formats other than the standard format. What you can do is to define a string data type with a pattern constraint; but it won’t have date semantics, for example it will accept 1999/02/29.
Saxon’s XSD processor has an experimental extension, saxon:preprocess, which allows you to change the lexical representation of a data type. Not many people use it, of course, because they want their schemas to be interoperable; but it does exactly what you want so I thought I would mention it.
Another solution which is often overlooked, and which is perhaps more practical, is for your processing pipeline to do a transformation step before it does the validation step. This approach can be used to overcome many of the limitations of XML Schema, and it isn’t widely enough known.