Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1562

Issue with XSD 1.1 assertions with dateTime and duration

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.11.0
    • 2.12.0
    • None

    Description

      I'm working off of the latest 1.1 branch. I have the following schema:

      <schema
      elementFormDefault="qualified"
      attributeFormDefault="unqualified"
      xmlns="http://www.w3.org/2001/XMLSchema"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:tst="http://www.rackspace.com/test/simple"
      targetNamespace="http://www.rackspace.com/test/simple">

      <element name="test" type="tst:Duration"/>

      <complexType name="Duration">
      <attribute name="start" type="xsd:dateTime" use="required"/>
      <attribute name="end" type="xsd:dateTime" use="required"/>
      <assert test="xsd:dateTime(@end) le (xsd:dateTime(@start) + xsd:dayTimeDuration('P1D'))"/>
      </complexType>

      </schema>

      Essentially, I want to make sure that the duration between start and end is not longer than one day. I test against two documents (using options -fx and -xsd11 on the CLI validator):

      good.xml

      <test xmlns="http://www.rackspace.com/test/simple"
      start="2012-03-12T11:51:11Z" end="2012-03-13T11:51:11Z"/>

      this document should validate. And

      bad.xml

      <test xmlns="http://www.rackspace.com/test/simple"
      start="2012-03-12T11:51:11Z" end="2012-03-13T11:51:12Z"/>

      which should trip the assertion.

      Unfortunately xerces fails both documents, which looks like a bug to me especially since Saxon passes good.xml but fails bad.xml.

      Attachments

        Activity

          People

            mukul_gandhi Mukul Gandhi
            jorgew Jorge L. Williams
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: