XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Temporal Type Selection

I have a use case to provide the end-user the ability to select to use
a datetime, date or partial date at data entry time.

I have a master schema that has this as my base temporal complexType:

  <xs:complexType name="DvTemporalType">
    <xs:annotation>
      <xs:documentation>Defines the concept of date and time types.
</xs:documentation>
    </xs:annotation>
    <xs:complexContent>
      <xs:extension base="mlhim2:DvOrderedType">
        <xs:sequence>
          <xs:element maxOccurs="1" minOccurs="0" name="DvTemporal-dv">
            <xs:annotation>
              <xs:documentation>Must be constrained in CCDs to be one
of a set of DvTemporalType sub-types.  This gives the modeller the
ability to optionally allow partial dates at run time.
</xs:documentation>
            </xs:annotation>
            <xs:complexType>
              <xs:choice>
                <xs:element name="date" type="mlhim2:DvDateType"/>
                <xs:element name="time" type="mlhim2:DvTimeType"/>
                <xs:element name="datetime" type="mlhim2:DvDateTimeType"/>
                <xs:element name="day" type="mlhim2:DvDayType"/>
                <xs:element name="month" type="mlhim2:DvMonthType"/>
                <xs:element name="year" type="mlhim2:DvYearType"/>
                <xs:element name="year-month" type="mlhim2:DvYearMonthType"/>
                <xs:element name="month-day" type="mlhim2:DvMonthDayType"/>
              </xs:choice>
            </xs:complexType>
          </xs:element>
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>


I envision a schema that can further constrain the master schema type
to only allow full or partial dates.

        <xs:complexType name='ct-0ac3f22e-64ca-4309-be88-874cd14649a0'>
                <xs:complexContent>
                        <xs:restriction base='mlhim2:DvTemporalType'>
                                <xs:sequence>

                                     [extra semantics removed for brevity]

                                        <xs:element maxOccurs="1"
minOccurs="1" name="DvTemporal-dv">
                                          <xs:complexType>
                                            <xs:choice>
                                              <xs:element name="date"
type="mlhim2:DvDateType"/>
                                              <xs:element name="day"
type="mlhim2:DvDayType"/>
                                              <xs:element name="month"
type="mlhim2:DvMonthType"/>
                                              <xs:element name="year"
type="mlhim2:DvYearType"/>
                                              <xs:element
name="year-month" type="mlhim2:DvYearMonthType"/>
                                              <xs:element
name="month-day" type="mlhim2:DvMonthDayType"/>
                                            </xs:choice>
                                          </xs:complexType>
                                        </xs:element>
                                </xs:sequence>
                        </xs:restriction>
                </xs:complexContent>
        </xs:complexType>

 But i get an error this error:

F [Saxon-EE 9.4.0.4] The content model of the complex type
ct-0ac3f22e-64ca-4309-be88-874cd14649a0 is not a valid restriction of
the content model of the type DvTemporalType. Definition of element
DvTemporal-dv differs between the restricted type and the base type.
Type of element in restricted content model is not validly derived
from the type of the corresponding element in base content model


So my question is; given the use case (it must be a fairly common
request) how do you solve this?

Thanks in advance.

--Tim


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS