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 "Cronemberger, Constantino" <Co...@gft.com> on 2012/12/07 18:12:19 UTC

assert with count function does not work

Hi,

I have the following snippet in my XSD 1.1:

    <xs:complexType name="columns">
        <xs:sequence>
            <xs:element name="column" type="xs:string" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="count" type="xs:int" use="required"/>
        <xs:assert test="@count eq count(./column)" />
    </xs:complexType>

And when I try to validate this XML it fails:

    <columns count="3">
        <column>Description</column>
        <column/>
        <column>Name</column>
    </columns>

with the following message:

org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 15; cvc-assertion: Assertion evaluation ('@count eq count(./column)') for element 'columns' on schema type 'columns' did not succeed.

When I replace "@count" by "0" it works, so it looks like the count function is not working. I tried to call the function "countX" and got the error message: "XPST0017 - Function does not exist: countX arity: 1."

I have used the revision 1418386 on https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev.

Any ideas of why this is happening?

Thanks,

Constantino Cronemberger
_____________________________________________________________________________

 <http://www.gft.com/cebit> [cid:logo]

GFT Brasil Consultoria Informática Ltda.
Av. Sao Francisco, 98
18.095-450 Sorocaba
BRASIL

T +55 15 3332 9720
F +55 15 3332 9711
Constantino.Cronemberger@gft.com
www.gft.com/br<http://www.gft.com/br>
www.gft-blog.com.br<http://www.gft-blog.com.br>
www.twitter.com/gft_br<http://www.twitter.com/gft_br>
_____________________________________________________________________________


Re: assert with count function does not work

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Constantino,
   I tried the XSD validation with latest Xerces SVN codebase using your
example in this test case, and got an assertion failure (i.e a 'false'
result) rather than an indication of bug.

Your XML document is in a namespace. If I change your assertion to
following,

<xs:assert test="@count eq count(./column)"
xpathDefaultNamespace="##targetNamespace"/>

I get the expected result.

On Tue, Dec 11, 2012 at 6:43 PM, Cronemberger, Constantino <
Constantino.Cronemberger@gft.com> wrote:

>  Hi,
>
> I have downloaded the referred revision:
>
> $ svn info
> Path: .
> Working Copy Root Path: /cygdrive/c/development/xml-schema-1.1-dev
> URL:
> https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev
> Repository Root: https://svn.apache.org/repos/asf
> Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
> Revision: 1414220
> Node Kind: directory
> Schedule: normal
> Last Changed Author: mukulg
> Last Changed Rev: 1414220
> Last Changed Date: 2012-11-27 13:06:55 -0200 (Tue, 27 Nov 2012)
>
> But still got the same problem.
>
> I have created a simple test app which is attached in this e-mail. All
> jars used are from SVN.
>
> Regards,
>     Constantino
>
>  *Constantino Cronemberger*
>
> ****
>
>
> _____________________________________________________________________________
>
> ****
>
> *  <http://www.gft.com/cebit>*
>
> *
> GFT Brasil Consultoria Informática Ltda.*
> **
>
> **
>
> Av. Sao Francisco, 98
>
>  18.095-450 Sorocaba
>
> BRASIL
>
> ** **
>
> T +55 15 3332 9720
>
> F +55 15 3332 9711
>
>  Constantino.Cronemberger@gft.com
>
> www.gft.com/br
>
> www.gft-blog.com.br
>
> www.twitter.com/gft_br
>
>
> _____________________________________________________________________________
> ****
>
>
>


-- 
Regards,
Mukul Gandhi

RE: assert with count function does not work

Posted by "Cronemberger, Constantino" <Co...@gft.com>.
Hi,

I have downloaded the referred revision:

$ svn info
Path: .
Working Copy Root Path: /cygdrive/c/development/xml-schema-1.1-dev
URL: https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev
Repository Root: https://svn.apache.org/repos/asf
Repository UUID: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 1414220
Node Kind: directory
Schedule: normal
Last Changed Author: mukulg
Last Changed Rev: 1414220
Last Changed Date: 2012-11-27 13:06:55 -0200 (Tue, 27 Nov 2012)

But still got the same problem.

I have created a simple test app which is attached in this e-mail. All jars used are from SVN.

Regards,
    Constantino

Constantino Cronemberger
_____________________________________________________________________________

 <http://www.gft.com/cebit> [cid:logo]

GFT Brasil Consultoria Informática Ltda.
Av. Sao Francisco, 98
18.095-450 Sorocaba
BRASIL

T +55 15 3332 9720
F +55 15 3332 9711
Constantino.Cronemberger@gft.com
www.gft.com/br<http://www.gft.com/br>
www.gft-blog.com.br<http://www.gft-blog.com.br>
www.twitter.com/gft_br<http://www.twitter.com/gft_br>
_____________________________________________________________________________

________________________________
From: Mukul Gandhi [mukulg@apache.org]
Sent: Sunday, December 09, 2012 12:28
To: j-users@xerces.apache.org
Subject: Re: assert with count function does not work

Hi Constantino,
    The latest Xerces-J commit produced SVN version 1414220. With this, the problem you've reported doesn't exist.

Can you please try with the latest Xerces SVN version.

On Fri, Dec 7, 2012 at 10:42 PM, Cronemberger, Constantino <Co...@gft.com>> wrote:
Hi,

I have the following snippet in my XSD 1.1:

    <xs:complexType name="columns">
        <xs:sequence>
            <xs:element name="column" type="xs:string" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="count" type="xs:int" use="required"/>
        <xs:assert test="@count eq count(./column)" />
    </xs:complexType>

And when I try to validate this XML it fails:

    <columns count="3">
        <column>Description</column>
        <column/>
        <column>Name</column>
    </columns>

with the following message:

org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 15; cvc-assertion: Assertion evaluation ('@count eq count(./column)') for element 'columns' on schema type 'columns' did not succeed.

When I replace "@count" by "0" it works, so it looks like the count function is not working. I tried to call the function "countX" and got the error message: "XPST0017 - Function does not exist: countX arity: 1."

I have used the revision 1418386 on https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev.

Any ideas of why this is happening?

Thanks,

Constantino Cronemberger
_____________________________________________________________________________

 <http://www.gft.com/cebit> [cid:logo]

GFT Brasil Consultoria Informática Ltda.
Av. Sao Francisco, 98
18.095-450 Sorocaba
BRASIL

T +55 15 3332 9720<tel:%2B55%2015%203332%209720>
F +55 15 3332 9711<tel:%2B55%2015%203332%209711>
Constantino.Cronemberger@gft.com<ma...@gft.com>
www.gft.com/br<http://www.gft.com/br>
www.gft-blog.com.br<http://www.gft-blog.com.br>
www.twitter.com/gft_br<http://www.twitter.com/gft_br>
_____________________________________________________________________________



--
Regards,
Mukul Gandhi


Re: assert with count function does not work

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Constantino,
    The latest Xerces-J commit produced SVN version 1414220. With this, the
problem you've reported doesn't exist.

Can you please try with the latest Xerces SVN version.

On Fri, Dec 7, 2012 at 10:42 PM, Cronemberger, Constantino <
Constantino.Cronemberger@gft.com> wrote:

>  Hi,
>
> I have the following snippet in my XSD 1.1:
>
>     <xs:complexType name="columns">
>         <xs:sequence>
>             <xs:element name="column" type="xs:string"
> maxOccurs="unbounded"/>
>         </xs:sequence>
>         <xs:attribute name="count" type="xs:int" use="required"/>
>         <xs:assert test="@count eq count(./column)" />
>     </xs:complexType>
>
> And when I try to validate this XML it fails:
>
>     <columns count="3">
>         <column>Description</column>
>         <column/>
>         <column>Name</column>
>     </columns>
>
> with the following message:
>
> org.xml.sax.SAXParseException; lineNumber: 12; columnNumber: 15;
> cvc-assertion: Assertion evaluation ('@count eq count(./column)') for
> element 'columns' on schema type 'columns' did not succeed.
>
> When I replace "@count" by "0" it works, so it looks like the count
> function is not working. I tried to call the function "countX" and got the
> error message: "XPST0017 - Function does not exist: countX arity: 1."
>
> I have used the revision 1418386 on
> https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev.
>
> Any ideas of why this is happening?
>
> Thanks,
>
>  *Constantino Cronemberger*
>
> ****
>
>
> _____________________________________________________________________________
>
> ****
>
> *  <http://www.gft.com/cebit>*
>
> *
> GFT Brasil Consultoria Informática Ltda.*
> **
>
> **
>
> Av. Sao Francisco, 98
>
>  18.095-450 Sorocaba
>
> BRASIL
>
> ** **
>
> T +55 15 3332 9720
>
> F +55 15 3332 9711
>
>  Constantino.Cronemberger@gft.com
>
> www.gft.com/br
>
> www.gft-blog.com.br
>
> www.twitter.com/gft_br
>
>
> _____________________________________________________________________________
>



>
> --
> Regards,
> Mukul Gandhi
>
>