Datatype: textDateType

Description:

A datatype of textDateType is considered to be an undesirable choice for dates. However, it is included for those who wish to use non-standard date formats. The other two date types are parsedDateType, which declares a date with separate year, month, day tags, and isoDateType, which uses the ISO 8601 standard format.

The textDateType is a free format string with a mandatory type attribute. It is strictly up to the application program to interpret the type attribute and to be able to parse the text string if necessary.

Proposed Usage:

This datatype was developed to support the use of non-standard date formats, such as the American format of mm/dd/yy or the European format of dd/mm/yy.

XML Schema:

  • The schema and examples do not explicitly show the lines that set the namespaces.
  • All schema examples will use xsd: as the namespace for the schema tags and datatypes, and null for all the locally generated namespaces.
  • XML Examples will exclude namespace modifiers for clarity. Actual XML will probably need namespaces.
  • <xsd:complexType name="textDateType">
     <xsd:simpleContent>
      <xsd:extension base="xsd:string">
       <xsd:attribute name="type" type="xsd:string" use="required"/>
      </xsd:extension>
     </xsd:simpleContent>
    </xsd:complexType>
    

    Sample Usage Schema:

  • This may be used as a choice with other date datatypes to allow other formats. Compare, in particular, with parsedDateType and isoDateType.
  • It may be desirable to add an additional layer to identify the date as a text formatted date so that a reader application will know. Both methods are shown below.
  •    <xsd:element name="SpudDate" type="textDateType"/>
    
       <xsd:element name="CompletionDate>
        <xsd:complexType>
         <xsd:sequence>
          <xsd:element name="USDate" type="textDateType"/>
         </xsd:sequence>
        </xsd:complexType>
       </xsd:element>
    

    Sample XML:

       <SpudDate type="USFormat">4/22/99</SpudDate>
    
       <CompletionDate>
        <USDate type="dd/mm/yy">6/3/99</USDate>
       </CompletionDate>
    

    Last Modified: March 21, 2001
    ©Copyright 2001 POSC. All rights reserved.