[relaxng-user] datetime variation

Dave Pawson dpawson at nildram.co.uk
Sat Jan 17 14:03:43 ICT 2004


At 13:44 17/01/2004, David Tolpin wrote:
> > <modified>2001-01-11T12:01:01Z</modified>
> > I.e. the normal xsd dateTime, but with a mandated Z,
> > as apposed to the +- alternatives.
> >
> > Not working I have,
> >
> > <element name="modified">
> >   <data type="dateTime">
> >          <param name="minInclusive">2000-01-01T00:00:00Z</param>
> >          <param name="maxInclusive">2099-12-31T23:59:59Z</param>
> >          <param
> > name="pattern">[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]2:[0-9]2:[0-9]2Z</param>
> >         </data>
>
>here curly brackets are omitted around last two 2's, but what you actually
>want is <param name="pattern">.*Z</param>. It is already a date, so the
>only thing you need to say is that it ends with Z.

No, there's the time in there as well David.
... BUT :-)
Yours works!
fails on ...+2.00 which is a valid dateTime

Does jing validate both parts then,
the min and max of date and time?
I guess so.
Also manages to ignore the Z at the end!

The spec states that Z is a 'should' item, so its really
optional, hence the final one is

<element name="modified">
   <data type="dateTime">
           <param name="minInclusive">2000-01-01T00:00:00</param>
           <param name="maxInclusive">2099-12-31T23:59:59</param>
           <param
  name="pattern">.*(Z)?</param>
   </data>
  </element>

which works great.


> > Ideally I'd like to split it up,
> > date,
> > T
> > time
> > Z
> > I can't find a way to do this.
>
>I haven't understood this part.

If I could have
   <data> .. </data>
   <data> .. </data>
then I could 'join' the date, T, time, Z patterns on a token type.
But that's not allowed unfortunately.

That would really make it easy to 'build' patterns up.

Thanks again David.
  regards DaveP 




More information about the relaxng-user mailing list