Datatype: parsedDateType

Description:

A datatype of parsedDateType will have (up to) three subelements, representing the year, month, and day.

Proposed Usage:

This datatype was developed to support the Epicentre date and timestamp data types. Its intended usage is shown in the PEF date element document. However, it is clearly useful as a datatype in its own right. Its usage is shown below in the sample usage schema and sample XML.

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="parsedDateType">
     <xsd:sequence>
      <xsd:element name="year">
       <xsd:simpleType>
        <xsd:restriction base="xsd:string">
         <xsd:pattern value="[0-9]{4}"/>
        </xsd:restriction>
       </xsd:simpleType>
      </xsd:element>
      <xsd:sequence minOccurs="0" maxOccurs="1">
       <xsd:element name="month">
        <xsd:simpleType>
         <xsd:restriction base="xsd:string">
          <xsd:pattern value="(0?[1-9])|(1[0-2])"/>
         </xsd:restriction>
        </xsd:simpleType>
       </xsd:element>
       <xsd:element name="day" minOccurs="0">
        <xsd:simpleType>
         <xsd:restriction base="xsd:string">
          <xsd:pattern value="(0?[1-9])|([1,2][0-9])|(3[0,1])"/>
         </xsd:restriction>
        </xsd:simpleType>
       </xsd:element>
      </xsd:sequence>
     </xsd:sequence>
    </xsd:complexType>
    

    Sample Usage Schema:

  • All elements are local. It is recommended that elementFormDefault be "qualified."
  • This may be used as a choice with other date datatypes to allow other formats. Compare, in particular, with isoDate and textDate.
  • It may be desirable to add an additional layer to identify the date as a parsed date so that a reader application will know. Both methods are shown below.
  •    <xsd:element name="SpudDate" type="parsedDateType"/>
    
       <xsd:element name="CompletionDate>
        <xsd:complexType>
         <xsd:sequence>
          <xsd:element name="parsedDate" type="parsedDateType"/>
         </xsd:sequence>
        </xsd:complexType>
       </xsd:element>
    

    Sample XML:

       <SpudDate>
         <year>1999</year>
         <month>04</month>
         <day>22</day>
       </SpudDate>
    
       <CompletionDate>
        <parsedDate>
         <year>1999</year>
         <month>6</month>
         <day>3</day>
        </parsedDate>
       </CompletionDate>
    

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