xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Arnold, Curt" <Curt.Arn...@hyprotech.com>
Subject RE: Standards for representing dates?
Date Fri, 27 Oct 2000 16:27:00 GMT
The XML Schema datatypes documents (http://www.w3.org/tr/XMLSchema-2) define specific lexical
representations for dates and times that are based on ISO 9601.  Support for XML schema datatypes
are
being added to parsers as part of their support for XML schemas, but can be used independently.

Basically, if you wanted to create document instances that could be readily validated with
schema, you would use the datatypes lexical representation for the particular type that you
wanted.  Whether
you package that lexical representation as element content or an attribute is up to you.

For example, the datatypes document defines the lexical representation for an double to use
'.' as a decimal separator (as apposed to the comma).  If you want to have a document that
works well with
schema (or any technology that will schema for typing information) , you will use a '.' as
a decimal separator.

In the same way, if you want your documents containing dates to work well with schema and
future technologies, then use the lexical representations for dates in the datatypes document.

In that case, a representation of date should be

<my_namespace:date>2000-10-27</my_namespace:date>

This would be represented in a schema as

<xsd:schema targetNamespace="http://www.example.org/namespace/my_namespace"...>
	<xsd:element name="date" type="xsd:date"/>
</xsd:schema>

That approach would not get you any significant validation with DTD's, but if you used a schema
processor, it would validate that you didn't specify an invalid month or day.

Mime
View raw message