You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Jorge Williams <jo...@rackspace.com> on 2012/05/17 13:58:21 UTC

Issue with XSD 1.1 assertions with dateTime and duration...

Hey Guys,

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.

Thoughts?

jOrGe W.




---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Michael,

> Can this issue with the explicit cast be fixed in PsychoPath?

Definitely, fixing this issue is doable within PsychoPath engine. I'll
try to study, and possibly fix this as soon as I can or write
something on the list with my findings.



-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Jorge Williams <jo...@rackspace.com>.
Just got around to testing.  Works!

Thank you,

-jOrGe W

On Jun 16, 2012, at 3:37 AM, Mukul Gandhi wrote:

> Hi Jorge,
>   The fixes for this issue are now available on SVN (revision,
> 1350884). You may verify as appropriate.
> 
> On Fri, Jun 15, 2012 at 4:56 PM, Jorge Williams
> <jo...@rackspace.com> wrote:
>>> If making explicit casts in this case, helps users we would certainly
>>> try to implement it :)
>> 
>> It certainly will help me today :-)
>> 
>>> 
>>>> Please fix this bug :-)
>>> 
>>> Definitely. But I can't promise, how soon this can be implemented
>>> since changing PsychoPath XPath engine internals for this need may not
>>> be quite trivial.
>>> 
>>> 
>> 
>> No problem,  I understand.  I'll start working the issue from the Saxon end.
>> 
>> Thank you very much for looking into it,
>> 
>> -jOrGe W.
> 
> 
> 
> 
> -- 
> Regards,
> Mukul Gandhi
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Jorge,
   The fixes for this issue are now available on SVN (revision,
1350884). You may verify as appropriate.

On Fri, Jun 15, 2012 at 4:56 PM, Jorge Williams
<jo...@rackspace.com> wrote:
>> If making explicit casts in this case, helps users we would certainly
>> try to implement it :)
>
> It certainly will help me today :-)
>
>>
>>> Please fix this bug :-)
>>
>> Definitely. But I can't promise, how soon this can be implemented
>> since changing PsychoPath XPath engine internals for this need may not
>> be quite trivial.
>>
>>
>
> No problem,  I understand.  I'll start working the issue from the Saxon end.
>
> Thank you very much for looking into it,
>
> -jOrGe W.




-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Jorge Williams <jo...@rackspace.com>.
(Inline)

On Jun 15, 2012, at 1:08 AM, Mukul Gandhi wrote:

> Hi Jorge,
> 
> On Thu, Jun 14, 2012 at 5:44 PM, Jorge Williams
> <jo...@rackspace.com> wrote:
> 
>> I couldn't find anything in the standard that says that implementation must have typed nodes
> 
> The XSD 1.1 assertions spec here describes how the XDM data model for
> assertions need to be constructed,
> 
> http://www.w3.org/TR/xmlschema11-1/#sec-cvc-assertion
> 
> The paragraph "Validation Rule: Assertion Satisfied" says,
> 
> 1 A data model instance (see [XDM]) is constructed in the following way:
> 
>  1.1 E is validated ...
> 
>  1.2 A "partial" ·post-schema-validation infoset· describing the
> results of this partial validation of E is constructed.
> 
>  1.3 From the "partial" ·post-schema-validation infoset·, a data
> model instance is constructed as described in [XDM].
> 
> I think, this does imply that the assertions XDM tree must have typed
> nodes. Note that, the root node of the assert XDM tree is 'untyped'
> before assertions are evaluated (and all other nodes of assert tree
> are typed, before assertion evaluations).

Okay, I'll email the Saxon guys about it.

> 
>> so I don't think that they are doing anything wrong by requiring
> the cast.  The problem that I face is that I don't know what XSD
>> implementation my end users will be using, so I have to make sure that my XSDs work correctly no matter what.  If your
>> implementation can't handle the cast correctly,  I'd be forced to write two versions of an XSD, one for Xerces (without casts) and one > for Saxon (with casts) -- I find myself in this situation today and I don't think it's acceptable. As Michael noted in his previous email > it's a total pain -- having to write implementation specific versions of an XSD defeats the purpose of having a standard in the first
>> place.
> 
> If making explicit casts in this case, helps users we would certainly
> try to implement it :)

It certainly will help me today :-)

> 
>> Please fix this bug :-)
> 
> Definitely. But I can't promise, how soon this can be implemented
> since changing PsychoPath XPath engine internals for this need may not
> be quite trivial.
> 
> 

No problem,  I understand.  I'll start working the issue from the Saxon end.

Thank you very much for looking into it,

-jOrGe W.





---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Jorge,

On Thu, Jun 14, 2012 at 5:44 PM, Jorge Williams
<jo...@rackspace.com> wrote:

> I couldn't find anything in the standard that says that implementation must have typed nodes

The XSD 1.1 assertions spec here describes how the XDM data model for
assertions need to be constructed,

http://www.w3.org/TR/xmlschema11-1/#sec-cvc-assertion

The paragraph "Validation Rule: Assertion Satisfied" says,

1 A data model instance (see [XDM]) is constructed in the following way:

  1.1 E is validated ...

  1.2 A "partial" ·post-schema-validation infoset· describing the
results of this partial validation of E is constructed.

  1.3 From the "partial" ·post-schema-validation infoset·, a data
model instance is constructed as described in [XDM].

I think, this does imply that the assertions XDM tree must have typed
nodes. Note that, the root node of the assert XDM tree is 'untyped'
before assertions are evaluated (and all other nodes of assert tree
are typed, before assertion evaluations).

 > so I don't think that they are doing anything wrong by requiring
the cast.  The problem that I face is that I don't know what XSD
> implementation my end users will be using, so I have to make sure that my XSDs work correctly no matter what.  If your
> implementation can't handle the cast correctly,  I'd be forced to write two versions of an XSD, one for Xerces (without casts) and one > for Saxon (with casts) -- I find myself in this situation today and I don't think it's acceptable. As Michael noted in his previous email > it's a total pain -- having to write implementation specific versions of an XSD defeats the purpose of having a standard in the first
> place.

If making explicit casts in this case, helps users we would certainly
try to implement it :)

> Please fix this bug :-)

Definitely. But I can't promise, how soon this can be implemented
since changing PsychoPath XPath engine internals for this need may not
be quite trivial.



-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Jorge Williams <jo...@rackspace.com>.
There is a case where handling the cast correctly is critically important:  when you are dealing with an implementation where nodes are not typed.  In this case,  you *always* have to do a cast to inform the validator of the type of a particular value.  The Saxon implementation works this way, and I couldn't find anything in the standard that says that implementation must have typed nodes -- so I don't think that they are doing anything wrong by requiring the cast.  The problem that I face is that I don't know what XSD implementation my end users will be using, so I have to make sure that my XSDs work correctly no matter what.  If your implementation can't handle the cast correctly,  I'd be forced to write two versions of an XSD, one for Xerces (without casts) and one for Saxon (with casts) -- I find myself in this situation today and I don't think it's acceptable. As Michael noted in his previous email it's a total pain -- having to write implementation specific versions of an XSD defeats the purpose of having a standard in the first place.

Please fix this bug :-)

Thanks,

jOrGe W.

On Jun 13, 2012, at 3:40 PM, Mukul Gandhi wrote:

> Hi Michael & all,
>   Here are few new thoughts I've about these issues, and writing them
> to list here for records.
> 
> The XSD type xs:dateTime has the parent type as xs:anyAtomicType. So
> if an XDM node reference already has a type annotation as xs:dateTime,
> I see no good value to do an explicit cast on such a node reference
> (except as a user-opted lexical style).
> 
> A probably interesting analogy wrt explicit casts for type
> xs:dateTime, can be made with the following example,
> 
> The type xs:long has the parent type as xs:integer. So if an XDM item
> reference has a type annotation as xs:long (let's call it $x), then I
> definitely see value in doing an explicit case like xs:integer($x),
> since the value space of xs:long is a subset of value space of
> xs:integer and we could use the expression xs:integer($x) in contexts
> where an xs:integer value is expected. And I do find, these scenarios
> to be working fine with PsychoPath XPath2 engine.
> 
> I do agree, that the inability to do explicit casts on xs:dateTime
> references is probably a bug, but as I wrote above I see almost no
> use-case value of making this fix.
> 
> On Thu, May 24, 2012 at 1:32 PM, Michael Glavassevich
> <mr...@ca.ibm.com> wrote:
>> Hi Mukul,
>> 
>> Regardless of the severity I agree with Jorge that it's a pain if you can't
>> write an XPath expression which works with both (Xerces and Saxon)
>> implementations. Can this issue with the explicit cast be fixed in
>> PsychoPath?
>> 
>> Thanks.
>> 
>> Michael Glavassevich
>> XML Technologies and WAS Development
>> IBM Toronto Lab
>> E-mail: mrglavas@ca.ibm.com
>> E-mail: mrglavas@apache.org
> 
> 
> 
> 
> -- 
> Regards,
> Mukul Gandhi
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <ga...@gmail.com>.
Hi Michael & all,
   Here are few new thoughts I've about these issues, and writing them
to list here for records.

The XSD type xs:dateTime has the parent type as xs:anyAtomicType. So
if an XDM node reference already has a type annotation as xs:dateTime,
I see no good value to do an explicit cast on such a node reference
(except as a user-opted lexical style).

A probably interesting analogy wrt explicit casts for type
xs:dateTime, can be made with the following example,

The type xs:long has the parent type as xs:integer. So if an XDM item
reference has a type annotation as xs:long (let's call it $x), then I
definitely see value in doing an explicit case like xs:integer($x),
since the value space of xs:long is a subset of value space of
xs:integer and we could use the expression xs:integer($x) in contexts
where an xs:integer value is expected. And I do find, these scenarios
to be working fine with PsychoPath XPath2 engine.

I do agree, that the inability to do explicit casts on xs:dateTime
references is probably a bug, but as I wrote above I see almost no
use-case value of making this fix.

On Thu, May 24, 2012 at 1:32 PM, Michael Glavassevich
<mr...@ca.ibm.com> wrote:
> Hi Mukul,
>
> Regardless of the severity I agree with Jorge that it's a pain if you can't
> write an XPath expression which works with both (Xerces and Saxon)
> implementations. Can this issue with the explicit cast be fixed in
> PsychoPath?
>
> Thanks.
>
> Michael Glavassevich
> XML Technologies and WAS Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org




-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Mukul,

Regardless of the severity I agree with Jorge that it's a pain if you 
can't write an XPath expression which works with both (Xerces and Saxon) 
implementations. Can this issue with the explicit cast be fixed in 
PsychoPath?

Thanks.

Michael Glavassevich
XML Technologies and WAS Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Mukul Gandhi <mu...@apache.org> wrote on 24/05/2012 01:50:21 AM:

> Hi Jorge,
> 
> On Thu, May 24, 2012 at 1:15 AM, Jorge Williams
> <jo...@rackspace.com> wrote:
> > Okay confirmed that the validation works if you remove the 
> explicit casts...but doesn't that mean that there's another bug? 
>  Regardless as to whether or not the explicit casts are needed the 
> behavior of the validation should be the same.
> 
> Without confirming with the XPath 2.0 spec (but I'll check!) I would
> agree that even if the XDM nodes are typed, an explicit cast on the
> node should still produce the same result. But this bug is of much
> lesser severity, than the bug which has been solved upto now -- I say
> this, because I don't see a point in doing explicit casts on nodes
> which are already typed. But we should still try to solve this bug as
> well :)
> 
> As a side note, an explicit cast on node which is already typed may be
> useful in cases where, the type to which a cast is attempted is
> related to the type of the node via inheritance (again we would need
> to check the spec, what is the expected behavior in this case).
> 
> 
> 
> -- 
> Regards,
> Mukul Gandhi
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Jorge,

On Thu, May 24, 2012 at 1:15 AM, Jorge Williams
<jo...@rackspace.com> wrote:
> Okay confirmed that the validation works if you remove the explicit casts...but doesn't that mean that there's another bug?  Regardless as to whether or not the explicit casts are needed the behavior of the validation should be the same.

Without confirming with the XPath 2.0 spec (but I'll check!) I would
agree that even if the XDM nodes are typed, an explicit cast on the
node should still produce the same result. But this bug is of much
lesser severity, than the bug which has been solved upto now -- I say
this, because I don't see a point in doing explicit casts on nodes
which are already typed. But we should still try to solve this bug as
well :)

As a side note, an explicit cast on node which is already typed may be
useful in cases where, the type to which a cast is attempted is
related to the type of the node via inheritance (again we would need
to check the spec, what is the expected behavior in this case).



-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Jorge Williams <jo...@rackspace.com>.
On May 24, 2012, at 3:45 PM, Mukul Gandhi wrote:

Thanks, Jorge for bringing these issues to the list :)


No problem.  Thanks for addressing these issues so quickly!

-jOrGe W.


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Michael,
   Surely, the bugs reported in this mail thread were in PsychoPath
XPath engine. PsychoPath engine does claim conformance to the W3C
XPath 2.0 test suite, and at the moment we do pass 100% of this test
suite.

Incidentally, the issues highlighted in this mail thread with respect
to certain XPath 2.0 F&O behaviors with PsychoPath engine, are not
covered in the current W3C XPath 2.0 test suite.

Also to mention, we do regression of the W3C XPath 2.0 test suite (our
implementation of this is located at, the Eclipse Source Editing site)
whenever we introduce any changes to the PsychoPath XPath 2.0 engine,
to make sure we're not breaking any existing functionality of
PsychoPath engine with any new changes.

On Fri, May 25, 2012 at 1:44 AM, Michael Glavassevich
<mr...@ca.ibm.com> wrote:
> That's true, assuming PsychoPath is being tested that way. Have never really
> looked at what goes on in Eclipse-land. Mukul should know though.
>
> Thanks.
>
> Michael Glavassevich
> XML Technologies and WAS Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org




-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
That's true, assuming PsychoPath is being tested that way. Have never 
really looked at what goes on in Eclipse-land. Mukul should know though.

Thanks.

Michael Glavassevich
XML Technologies and WAS Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Jorge Williams <jo...@rackspace.com> wrote on 24/05/2012 06:18:24 
PM:

> Hey Guys,
> 
> Seems like the last couple of bugs relate to the XPath 2 engine 
> specifically.   If PsycoPath claims full conformance, then the 
> deficiencies are really in the XPath 2 test suite.
> 
> -jOrGe W.
> 
> On May 24, 2012, at 4:10 PM, Mukul Gandhi wrote:
> 
> > Hi Michael,
> >    I believe, the W3C's XML Schema 1.1 test suite has a significant
> > coverage for XSD 1.1 assertions.
> > 
> > But I would agree, that <assertion> tests like those cited within this
> > thread and probably some others as well could be added to W3C XSD 1.1
> > test suite, for the reasons you've mentioned.
> > 
> > Probably, if someone like Sandy takes initiative to have such tests
> > added to XSD 1.1 test suite, it would be great. I'm certainly willing
> > to provide new tests like these, in the W3C XSD 1.1 test suite format.
> > 
> > 
> > On Thu, May 24, 2012 at 9:57 PM, Michael Glavassevich
> > <mr...@ca.ibm.com> wrote:
> >> I'm curious what kind of coverage there is for assertions in the 
W3C's XML
> >> Schema 1.1 test suite. If it were enhanced to cover more 
> scenarios like this
> >> one and others we've been discussing on this list lately it would 
help
> >> improve interoperability.
> >> 
> >> Thanks.
> >> 
> >> Michael Glavassevich
> >> XML Technologies and WAS Development
> >> IBM Toronto Lab
> >> E-mail: mrglavas@ca.ibm.com
> >> E-mail: mrglavas@apache.org
> > 
> > 
> > 
> > 
> > -- 
> > Regards,
> > Mukul Gandhi
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> > For additional commands, e-mail: j-users-help@xerces.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Jorge Williams <jo...@rackspace.com>.
Hey Guys,

Seems like the last couple of bugs relate to the XPath 2 engine specifically.   If PsycoPath claims full conformance, then the deficiencies are really in the XPath 2 test suite.

-jOrGe W.

On May 24, 2012, at 4:10 PM, Mukul Gandhi wrote:

> Hi Michael,
>    I believe, the W3C's XML Schema 1.1 test suite has a significant
> coverage for XSD 1.1 assertions.
> 
> But I would agree, that <assertion> tests like those cited within this
> thread and probably some others as well could be added to W3C XSD 1.1
> test suite, for the reasons you've mentioned.
> 
> Probably, if someone like Sandy takes initiative to have such tests
> added to XSD 1.1 test suite, it would be great. I'm certainly willing
> to provide new tests like these, in the W3C XSD 1.1 test suite format.
> 
> 
> On Thu, May 24, 2012 at 9:57 PM, Michael Glavassevich
> <mr...@ca.ibm.com> wrote:
>> I'm curious what kind of coverage there is for assertions in the W3C's XML
>> Schema 1.1 test suite. If it were enhanced to cover more scenarios like this
>> one and others we've been discussing on this list lately it would help
>> improve interoperability.
>> 
>> Thanks.
>> 
>> Michael Glavassevich
>> XML Technologies and WAS Development
>> IBM Toronto Lab
>> E-mail: mrglavas@ca.ibm.com
>> E-mail: mrglavas@apache.org
> 
> 
> 
> 
> -- 
> Regards,
> Mukul Gandhi
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Michael,
    I believe, the W3C's XML Schema 1.1 test suite has a significant
coverage for XSD 1.1 assertions.

But I would agree, that <assertion> tests like those cited within this
thread and probably some others as well could be added to W3C XSD 1.1
test suite, for the reasons you've mentioned.

Probably, if someone like Sandy takes initiative to have such tests
added to XSD 1.1 test suite, it would be great. I'm certainly willing
to provide new tests like these, in the W3C XSD 1.1 test suite format.


On Thu, May 24, 2012 at 9:57 PM, Michael Glavassevich
<mr...@ca.ibm.com> wrote:
> I'm curious what kind of coverage there is for assertions in the W3C's XML
> Schema 1.1 test suite. If it were enhanced to cover more scenarios like this
> one and others we've been discussing on this list lately it would help
> improve interoperability.
>
> Thanks.
>
> Michael Glavassevich
> XML Technologies and WAS Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org




-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
I'm curious what kind of coverage there is for assertions in the W3C's XML 
Schema 1.1 test suite. If it were enhanced to cover more scenarios like 
this one and others we've been discussing on this list lately it would 
help improve interoperability.

Thanks.

Michael Glavassevich
XML Technologies and WAS Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Mukul Gandhi <mu...@apache.org> wrote on 24/05/2012 04:45:07 PM:

> Interestingly, related to the addition dateTime's evaluation bug the
> PaychoPath XPath2 engine also had a bug doing subtraction operations
> on the same data types.
> 
> For e.g, the following XSD 1.1 validation didn't work correctly,
> 
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
> 
>    <xs:element name="test" type="X1"/>
> 
>    <xs:complexType name="X1">
>          <xs:attribute name="start" type="xs:dateTime" use="required"/>
>     <xs:assert test="(@start - xs:dayTimeDuration('P2D')) eq
> xs:dateTime('2012-03-10T10:10:05')"/>
>    </xs:complexType>
> 
> </xs:schema>
> 
> This schema should successfully validate the following XML instance 
document,
> 
> <test start="2012-03-12T10:10:05"/>
> 
> I've committed this fix as well few minutes ago.
> 
> Thanks, Jorge for bringing these issues to the list :)
> 
> On Thu, May 24, 2012 at 1:15 AM, Jorge Williams
> <jo...@rackspace.com> wrote:
> > Okay confirmed that the validation works if you remove the 
> explicit casts...but doesn't that mean that there's another bug? 
>  Regardless as to whether or not the explicit casts are needed the 
> behavior of the validation should be the same.
> 
> 
> 
> 
> -- 
> Regards,
> Mukul Gandhi
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <mu...@apache.org>.
Interestingly, related to the addition dateTime's evaluation bug the
PaychoPath XPath2 engine also had a bug doing subtraction operations
on the same data types.

For e.g, the following XSD 1.1 validation didn't work correctly,

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

   <xs:element name="test" type="X1"/>

   <xs:complexType name="X1">
         <xs:attribute name="start" type="xs:dateTime" use="required"/>
	 <xs:assert test="(@start - xs:dayTimeDuration('P2D')) eq
xs:dateTime('2012-03-10T10:10:05')"/>
   </xs:complexType>

</xs:schema>

This schema should successfully validate the following XML instance document,

<test start="2012-03-12T10:10:05"/>

I've committed this fix as well few minutes ago.

Thanks, Jorge for bringing these issues to the list :)

On Thu, May 24, 2012 at 1:15 AM, Jorge Williams
<jo...@rackspace.com> wrote:
> Okay confirmed that the validation works if you remove the explicit casts...but doesn't that mean that there's another bug?  Regardless as to whether or not the explicit casts are needed the behavior of the validation should be the same.




-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Jorge Williams <jo...@rackspace.com>.
Okay confirmed that the validation works if you remove the explicit casts...but doesn't that mean that there's another bug?  Regardless as to whether or not the explicit casts are needed the behavior of the validation should be the same.

I bring this up because the Saxon implementation fails if the casts are not there -- I'm guessing the nodes are not typed in that implementation.

I'd hate to have one schema for Saxon and another for Xerces -- the same schema should work on both implementations.

Thoughs?

-jOrGe W.

On May 23, 2012, at 12:52 AM, Mukul Gandhi wrote:

> Hi Jorge,
>   Your example uses explicit casts on the XDM nodes, in xs:assert expressions.
> 
> If I remove explicit casts from the attribute node references in your
> examples, I get the expected results. i.e like <assert test="@end le
> (@start + xsd:dayTimeDuration('P1D'))"/>   and   <assert test="(@end -
> @start) le xsd:dayTimeDuration('P1D')"/>.
> 
> Since the xs:assert XDM nodes are typed, we don't need to explicitly
> cast them during XPath expression evaluation.
> 
> 
> On Tue, May 22, 2012 at 11:30 PM, Jorge Williams
> <jo...@rackspace.com> wrote:
>> Hi Mukul,
>> 
>> Just updated.  Unfortunately,  I'm still getting the same error with the
>> same example.  Am I doing something wrong?  I'm attaching example and sample
>> documents.  good.xml should succeed for both schema, but it doesn't :-(
>> 
>> Thanks,
>> 
>> -jOrGe W.
> 
> 
> 
> -- 
> Regards,
> Mukul Gandhi
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Jorge,
   Your example uses explicit casts on the XDM nodes, in xs:assert expressions.

If I remove explicit casts from the attribute node references in your
examples, I get the expected results. i.e like <assert test="@end le
(@start + xsd:dayTimeDuration('P1D'))"/>   and   <assert test="(@end -
@start) le xsd:dayTimeDuration('P1D')"/>.

Since the xs:assert XDM nodes are typed, we don't need to explicitly
cast them during XPath expression evaluation.


On Tue, May 22, 2012 at 11:30 PM, Jorge Williams
<jo...@rackspace.com> wrote:
> Hi Mukul,
>
> Just updated.  Unfortunately,  I'm still getting the same error with the
> same example.  Am I doing something wrong?  I'm attaching example and sample
> documents.  good.xml should succeed for both schema, but it doesn't :-(
>
> Thanks,
>
> -jOrGe W.



-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Jorge Williams <jo...@rackspace.com>.
Hi Mukul,

Just updated.  Unfortunately,  I'm still getting the same error with the same example.  Am I doing something wrong?  I'm attaching example and sample documents.  good.xml should succeed for both schema, but it doesn't :-(

Thanks,

-jOrGe W.


On May 22, 2012, at 3:46 PM, Mukul Gandhi wrote:

> Hi Jorge,
>   I did try to fix this issue, and the changes for this are now
> committed to SVN.
>
> Xerces's XPath2 engine had a bug doing addition of xs:dateTime and
> xs:dayTimeDuration values, which I hope is now fixed completely.
> Please feel free to report, if you find anything still incorrect.
>
>
> On Fri, May 18, 2012 at 5:06 AM, Jorge Williams
> <jo...@rackspace.com> wrote:
>>
>> On May 17, 2012, at 2:56 PM, Mukul Gandhi wrote:
>>
>>> Hi Jorge,
>>>   With my quick analysis of your use-case, I can conclude that this
>>> may be a possible bug (and quite likely in our XSD 1.1 XPath2 engine).
>>>
>>> As a workaround, I can find the following expression to be working
>>> correctly though,
>>>
>>> (xs:dateTime - xs:dateTime) le xs:dayTimeDuration
>>
>> Cool, I'll give that a try...
>>
>>>
>>> You may report this issue on the JIRA system, and we'll try to solve it.
>>
>> Done: https://issues.apache.org/jira/browse/XERCESJ-1562
>>
>> Thanks!
>>
>> -jOrGe W.
>
>
>
>
> --
> Regards,
> Mukul Gandhi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Jorge,
   I did try to fix this issue, and the changes for this are now
committed to SVN.

Xerces's XPath2 engine had a bug doing addition of xs:dateTime and
xs:dayTimeDuration values, which I hope is now fixed completely.
Please feel free to report, if you find anything still incorrect.


On Fri, May 18, 2012 at 5:06 AM, Jorge Williams
<jo...@rackspace.com> wrote:
>
> On May 17, 2012, at 2:56 PM, Mukul Gandhi wrote:
>
>> Hi Jorge,
>>   With my quick analysis of your use-case, I can conclude that this
>> may be a possible bug (and quite likely in our XSD 1.1 XPath2 engine).
>>
>> As a workaround, I can find the following expression to be working
>> correctly though,
>>
>> (xs:dateTime - xs:dateTime) le xs:dayTimeDuration
>
> Cool, I'll give that a try...
>
>>
>> You may report this issue on the JIRA system, and we'll try to solve it.
>
> Done: https://issues.apache.org/jira/browse/XERCESJ-1562
>
> Thanks!
>
> -jOrGe W.




-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Jorge Williams <jo...@rackspace.com>.
On May 17, 2012, at 2:56 PM, Mukul Gandhi wrote:

> Hi Jorge,
>   With my quick analysis of your use-case, I can conclude that this
> may be a possible bug (and quite likely in our XSD 1.1 XPath2 engine).
> 
> As a workaround, I can find the following expression to be working
> correctly though,
> 
> (xs:dateTime - xs:dateTime) le xs:dayTimeDuration

Cool, I'll give that a try...

> 
> You may report this issue on the JIRA system, and we'll try to solve it.

Done: https://issues.apache.org/jira/browse/XERCESJ-1562

Thanks!

-jOrGe W.

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Issue with XSD 1.1 assertions with dateTime and duration...

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Jorge,
   With my quick analysis of your use-case, I can conclude that this
may be a possible bug (and quite likely in our XSD 1.1 XPath2 engine).

As a workaround, I can find the following expression to be working
correctly though,

(xs:dateTime - xs:dateTime) le xs:dayTimeDuration

You may report this issue on the JIRA system, and we'll try to solve it.

On Thu, May 17, 2012 at 12:58 PM, Jorge Williams
<jo...@rackspace.com> wrote:
>
> Hey Guys,
>
> 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.
>
> Thoughts?
>
> jOrGe W.



-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org