[tei-council] Datatype : roundup

Syd Bauman Syd_Bauman at Brown.edu
Thu Sep 22 07:08:21 EDT 2005


> Is there any sensible way to add timezone information to
> right-truncated times?

Yes, although it's no longer trivial. The regexp in the following
schema 
* does not permit the "military" timezone designators except for "Z",
  because that's what W3C does
* requires minutes in the non-"Z" time zone designators, because W3C
  does
* does permit minutes other than "00" and "30" in the minutes field
  of time zone designators, even though none exist, because that's what
  W3C does (I'm of half a mind to fix this oversight of theirs)
* does permit time zones greater than 14, because it's a royal pain
  to limit 'em, and W3C's own syntax doesn't (although semantically
  it's still an error, I think) -- I mostly copied the regexp from
  the W3C spec
* does not permit the hour to be "24", because that's a really
  really bad idea (one of 8601:2000's greatest failings, and the
  proof that it was written by committee)

--------- begin tim.rnc ---------
# test 'tim', a right-truncated 'time' :-)
start = element tests { test+ }
test = element test {
   attribute tim { xsd:token { pattern =
      "([01][0-9]|2[0-3])(:[0-5][0-9])?(((\+|-)[01][0-9]:[0-5][0-9])|Z)?"
   }
   }
}
--------- end tim.rnc ---------

--------- begin tim.xml ---------
<?xml version="1.0" encoding="UTF-8" ?>
<!-- should be valid -->
<tests>
  <test tim="10:32-04:00"/>
  <test tim="11+05:00"/>
  <test tim="12:34Z"/>
  <test tim="13Z"/>
</tests>
--------- end tim.xml ---------

--------- begin TIM.xml ---------
<?xml version="1.0" encoding="UTF-8" ?>
<!-- each attribute value should be invalid -->
<tests>
  <test tim="10:32-04"/>
  <test tim="11+98:00"/>
  <test tim="12:34J"/>
  <test tim="13K"/>
  <test tim="145"/>
  <test tim="15:16:17"/> <!-- valid against xsd:time -->
  <test tim="16:61+00:00"/>    <!-- no leap minutes! -->
  <test tim="17:98"/>
  <test tim="24:00"/>
  <test tim="32:00Z"/>
</tests>
--------- end TIM.xml ---------




More information about the tei-council mailing list