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

Validating throws exception on correct xs:datetime values representing a leap second

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.9.1
    • None
    • None
    • Java-SE-6u13 and u14

    Description

      W3C and ISO-8601 explicitely names and allows the value 60 for seconds, when the datetime defines a leap second.

      Xerces' "org.apache.xerces.impl.dv.xs.AbstractDateTimeDV.validateDateTime(DateTimeData data)" rejects such datetime values.

      My test XML schema is:
      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="unqualified" attributeFormDefault="unqualified">
      <xs:element name="leapSecond" type="xs:dateTime"/>
      </xs:schema>

      My test XML document is:
      <?xml version="1.0" encoding="UTF-8"?>
      <leapSecond xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="usingLeapSecond.xsd"
      >2008-12-31T23:59:60.000000Z</leapSecond>

      Variants ending with "...59:60Z" or "...59:60.000Z" are also rejected.

      "DocumentTracer.java" prints:
      MS-WiXP>java -jar DocumentTracer.jar -v -s -f ..\src\sample_60.000000Z.xml
      setDocumentLocator(locator=org.apache.xerces.parsers.AbstractSAXParser$LocatorProxy@19efb05)
      startDocument()
      startPrefixMapping(prefix="xsi",uri="http://www.w3.org/2001/XMLSchema-instance")
      startElement(uri="",localName="leapSecond",qname="leapSecond",attributes=uri="http://www.w3.org/2001/XMLSchema-instance",localName="noNamespaceSchemaLocation",qname="xsi:noNamespaceSchemaLocation", type="CDATA",value="usingLeapSecond.xsd") characters(text="2008-12-31T23:59:60.000000Z")
      [Error] sample_60.000000Z.xml:4:43: cvc-datatype-valid.1.2.1: '2008-12-31T23:59:60.000000Z' is not a valid value for 'dateTime'.
      [Error] sample_60.000000Z.xml:4:43: cvc-type.3.1.3: The value '2008-12-31T23:59:60.000000Z' of element 'leapSecond' is not valid.
      endElement(uri="",localName="leapSecond",qname="leapSecond")
      endPrefixMapping(prefix="xsi")
      endDocument()

      Leap seconds are very important for us. We are not randomely using them, but in fact naming them in our XML documents. Therefore, this exception when validating is a BLOCKER for us.

      Attachments

        Activity

          People

            Unassigned Unassigned
            genoko Gerhard Kozuschek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: