XML technologies / XML Schema / Data type reference / xs:gMonth

(Excerpt from “XML Schema” by Eric van der Vlist)

Recurring period: annual month

Derived from: xs:anySimpleType

Primitive type: xs:gMonth

Known subtypes: none

Facets: xs:enumeration, xs:maxExclusive, xs:maxInclusive, xs:minExclusive, xs:minInclusive, xs:pattern, xs:whiteSpace

Definition

<xs:simpleType name="gMonth" id="gMonth">
   <xs:restriction base="xs:anySimpleType">
      <xs:whiteSpace value="collapse" fixed="true"/>
   </xs:restriction>
</xs:simpleType>

Description

The value space of xs:gMonth consists of periods one calendar month long that recur every calendar year, such as June. The lexical space should follow ISO 8601 notation for such periods, “--MM”, with an optional time zone. However, a typo in the W3C XML Schema recommendation defines the format as “--MM--”. Although an erratum should be published to align W3C XML Schema with ISO 8601, most current schema processors expect the incorrect “--MM--” format. Our example follows the correct ISO-8601 format.

Restrictions

The recurrence period, one year, and duration, one month, are fixed, and only the Gregorian calendar is supported.

Because of the typo in the specification of W3C XML Schema, users must choose between an incorrect format working with current tool versions and a correct format complying with ISO 8601.

Example

Valid values include "--05", "--11Z", "--11+02:00", "--11-04:00" or "--02".

The following values would be invalid: "-01-" (the format must be "--MM" ), "--13" (the month is out of range), "--1" (both digits must be supplied) or "01"("--" is missing at the beginning).

   

back to top