Correct use of xsd:duration

This should cover W3C XML Schema, Relax NG and DTD related problems.
cberrymd
Posts: 7
Joined: Wed Jan 18, 2006 12:53 am
Contact:

Correct use of xsd:duration

Post by cberrymd » Wed Feb 01, 2006 10:58 pm

I have an element named dateEntered. To be valid it must be within the past 2 weeks. This explains what I'm trying to get to in pseudocode.

attribute dateEntered
{
xsd:date
{
minInclusive ="today" - P14D
maxInclusive ="today"
}
} , # a date within the past two weeks

Can somebody help me get to the real code?

george
Site Admin
Posts: 2101
Joined: Thu Jan 09, 2003 2:58 pm

Post by george » Thu Feb 02, 2006 11:17 am

Hi,

You cannot do that in XML Schema and it is har do no it in any schema language I think, just because today is not clearly defined - is that the time when the instance is created or the time the instance is checked? If it is the later then it is really strange to see a document became invalid just because you perform the validation at a givem moment in time.

Best Regards,
George

Post Reply