You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Jorge L. Williams (JIRA)" <xe...@xml.apache.org> on 2012/05/18 06:24:16 UTC
[jira] [Commented] (XERCESJ-1562) Issue with XSD 1.1 assertions
with dateTime and duration
[ https://issues.apache.org/jira/browse/XERCESJ-1562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13278568#comment-13278568 ]
Jorge L. Williams commented on XERCESJ-1562:
--------------------------------------------
Mukul Gandhi, mentioned the following on the list:
"As a workaround, I can find the following expression to be working
correctly though,
(xs:dateTime - xs:dateTime) le xs:dayTimeDuration"
Based on that I rewrote the schema to:
<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) - xsd:dateTime(@start)) le xsd:dayTimeDuration('P1D')"/>
</complexType>
</schema>
It's still not working correctly :-(
> Issue with XSD 1.1 assertions with dateTime and duration
> --------------------------------------------------------
>
> Key: XERCESJ-1562
> URL: https://issues.apache.org/jira/browse/XERCESJ-1562
> Project: Xerces2-J
> Issue Type: Bug
> Components: XML Schema 1.1 Datatypes
> Affects Versions: 2.11.0
> Reporter: Jorge L. Williams
>
> 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.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org
Re: [jira] [Commented] (XERCESJ-1562) Issue with XSD 1.1 assertions
with dateTime and duration
Posted by Mukul Gandhi <mu...@apache.org>.
Hi Jorge,
If I use an xs:assert with the following expression (i.e without
explicit casts on the attribute nodes, since attribute nodes are typed
within the xs:assert XDM tree)
(@end - @start) le xsd:dayTimeDuration('P1D')
I seem to get the expected result. Can you please check, if this would
work fine for you.
On Fri, May 18, 2012 at 5:24 AM, Jorge L. Williams (JIRA)
<xe...@xml.apache.org> wrote:
> Mukul Gandhi, mentioned the following on the list:
>
> "As a workaround, I can find the following expression to be working
> correctly though,
>
> (xs:dateTime - xs:dateTime) le xs:dayTimeDuration"
>
> Based on that I rewrote the schema to:
>
>
> <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) - xsd:dateTime(@start)) le xsd:dayTimeDuration('P1D')"/>
> </complexType>
>
> </schema>
>
> It's still not working correctly :-(
--
Regards,
Mukul Gandhi
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org