[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Temporal Type Selection

  • From: "Timothy W. Cook" <timothywayne.cook@gmail.com>
  • To: "xml-dev@lists.xml.org\"" <xml-dev@lists.xml.org>
  • Date: Wed, 26 Dec 2012 19:37:26 -0200

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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.