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 Yitzhak Khabinsky <Yi...@Millicom.com> on 2018/08/01 18:44:26 UTC

Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Hi Mukul,

I bumped into the problems with the following:

  1.  CTA expression evaluation
  2.  base-uri(.) function

Again for comparison, Saxon doesn't complain about the CTAs and the base-uri() in the XSD.

My tinkering:

  *   I added the -fx parameter (to turn on full XPath 2.0 checks with CTA when working with XSD 1.1), but it didn't help.
  *   I wrapped the @OrganizationCode attribute in string() and xs:string() to no avail.
It continues to trip on search in sequences.
  *   The CTA expression doesn't accept "eq" instead of "=":
<xs:alternative test="@OrganizationCode eq '3TZ005'" type="AccountCode-TZ-Zantel"/>
  *   It seems that the base-uri(.) function call is failing to return the fully qualified path to the XML file that is being validated.
     *   Saxon's base-uri(.) function call correctly emits the following:
file:///d:/Temp/CDW/IFRS/Tanzania/id2938_TZ20171231_IFRS15_CBCInput_3TZ005.xml

XSD fragment in question
<xs:element name="AccountCode" type="xs:string">
        <xs:alternative test="string(@OrganizationCode) = ('1GT001', '1GT005', '1GT006', '1GT010', '1HN001', '1HN003', '1SV001', '2BO002', '2PY003', '2PY007')" type="AccountCode-GT-HN-SV-BO-PY"/>
        <xs:alternative test="@OrganizationCode = '2CO001'" type="AccountCode-CO-Mobile"/>
        <xs:alternative test="xs:string(@OrganizationCode) = ('2CO008', '2CO009')" type="AccountCode-CO-Fixed"/>
        <xs:alternative test="xs:string(@OrganizationCode) = ('3TZ001', '3TZ002', '3TZ003', '3TZ004')" type="AccountCode-TZ"/>
        <xs:alternative test="@OrganizationCode = '3TZ005'" type="AccountCode-TZ-Zantel"/>
        <xs:alternative type="xs:error"/>
</xs:element>

XSD validation errors
[Error] IFRS15_CBC_In_Zantel.xsd:80:193: c-cta-xpath: The XPath expression 'string(@OrganizationCode) = ('1GT001', '1GT005', '1GT006', '1GT010', '1HN001', '1HN003', '1SV001', '2BO002', '2PY003', '2PY007')' couldn't compile successfully in 'cta-subset' mode, during CTA evaluation.
[Error] IFRS15_CBC_In_Zantel.xsd:82:110: c-cta-xpath: The XPath expression 'xs:string(@OrganizationCode) = ('2CO008', '2CO009')' couldn't compile successfully in 'cta-subset' mode, during CTA evaluation.
[Error] IFRS15_CBC_In_Zantel.xsd:83:124: c-cta-xpath: The XPath expression 'xs:string(@OrganizationCode) = ('3TZ001', '3TZ002', '3TZ003', '3TZ004')' couldn't compile successfully in 'cta-subset' mode, during CTA evaluation.
[Error] id2938_TZ20171231_IFRS15_CBCInput_3TZ005.xml:6559:8: cvc-assertion: Assertion evaluation ('ends-with(upper-case(base-uri(.)), upper-case(concat('_', @OrganizationCode, '.xml')))') for element 'root' on schema type '#AnonType_root' did not succeed.

Command Prompt
C:\Program Files\Stylus Studio X16 XML Enterprise Suite 64-bit\bin>"c:\Program Files\Java\jre1.8.0_181\bin\java.exe"  -Xms512m -Xmx1024m -Xbootclasspath/p:path:;c:\xerces212\xercesImpl.jar;c:\xerces212\xml-apis.jar;c:\xerces212\org.eclipse.wst.xml.xpath2.processor_1.2.0.jar;c:\xerces212\icu4j.jar;c:\xerces212\resolver.jar;c:\xerces212\serializer.jar;c:\xerces212\cupv10k-runtime.jar;c:\xerces212\xercesSamples.jar jaxp.SourceValidator -xsd11 -fx -i "file:///d:/Temp/CDW/IFRS/Tanzania/id2938_TZ20171231_IFRS15_CBCInput_3TZ005.xml"

The test case XML/XSD is in the attachment.

Thank you in advance.

Regards,
Yitzhak Khabinsky
Technical Services Lead
Millicom International Services LLC
396 Alhambra Circle, Suite 1100
Coral Gables, FL  33134
Skype4B: +1 (305) 445-4172
Tel: (954) 684-8673
yitzhak.khabinsky@millicom.com<ma...@millicom.com>
www.millicom.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.millicom.com%2F&data=02%7C01%7CMalcolm.Stewart%40microsoft.com%7C9338023699c2494d08be08d4ad12ce55%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636323743686702678&sdata=DxQ9dfL259rpdVZ9seOAcR6bvgxRobyIerOgvTgPc90%3D&reserved=0>


Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Posted by ykhabins <yi...@millicom.com>.
Hello,Here my command line statement:C:\Program Files\Stylus Studio X16 XML
Enterprise Suite 64-bit\bin>*"c:\Program
Files\Java\jre1.8.0_181\bin\java.exe"  -Xms512m -Xmx1024m
-Xbootclasspath/p:path:;c:\xerces212\xercesImpl.jar;c:\xerces212\xml-apis.jar;c:\xerces212\org.eclipse.wst.xml.xpath2.processor_1.2.0.jar;c:\xerces212\icu4j.jar;c:\xerces212\resolver.jar;c:\xerces212\serializer.jar;c:\xerces212\cupv10k-runtime.jar;c:\xerces212\xercesSamples.jar
jaxp.SourceValidator -xsd11 -fx -i "file:///d:/Temp/Xerces-J
2.12.0/XercesJ_TZ20171231_IFRS15_CBCInput_3TZ005.xml" *It doesn't recognize
the "-fx" parameter, and therefore , the XSD validation is not picking up
the full XPath 2.0 for the CTAs. It gives the following errors:[Error]
IFRS15_CBC_In_XercesJ.xsd:26:185: c-cta-xpath: The XPath expression
'@OrganizationCode = ('1GT001', '1GT005', '1GT006', '1GT010', '1HN001',
'1HN003', '1SV001', '2BO002', '2PY003', '2PY007')' couldn't compile
successfully in 'cta-subset' mode, during CTA evaluation.[Error]
IFRS15_CBC_In_XercesJ.xsd:27:89: c-cta-xpath: The XPath expression
'@OrganizationCode eq '2CO001'' couldn't compile successfully in
'cta-subset' mode, during CTA evaluation.[Error]
IFRS15_CBC_In_XercesJ.xsd:28:99: c-cta-xpath: The XPath expression
'@OrganizationCode = ('2CO008', '2CO009')' couldn't compile successfully in
'cta-subset' mode, during CTA evaluation.[Error]
IFRS15_CBC_In_XercesJ.xsd:29:113: c-cta-xpath: The XPath expression
'@OrganizationCode = ('3TZ001', '3TZ002', '3TZ003', '3TZ004')' couldn't
compile successfully in 'cta-subset' mode, during CTA evaluation.[Error]
XercesJ_TZ20171231_IFRS15_CBCInput_3TZ005.xml:8:8: cvc-assertion: Assertion
evaluation ('ends-with(upper-case(string(base-uri(.))),
upper-case(concat('_', @OrganizationCode, '.xml')))') for element 'root' on
schema type '#AnonType_root' did not succeed.



--
Sent from: http://apache-xml-project.6118.n7.nabble.com/Xerces-J-Users-f4.html

Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Posted by ykhabins <yi...@millicom.com>.
Hello,Here my command line statement:C:\Program Files\Stylus Studio X16 XML
Enterprise Suite 64-bit\bin>*"c:\Program
Files\Java\jre1.8.0_181\bin\java.exe"  -Xms512m -Xmx1024m
-Xbootclasspath/p:path:;c:\xerces212\xercesImpl.jar;c:\xerces212\xml-apis.jar;c:\xerces212\org.eclipse.wst.xml.xpath2.processor_1.2.0.jar;c:\xerces212\icu4j.jar;c:\xerces212\resolver.jar;c:\xerces212\serializer.jar;c:\xerces212\cupv10k-runtime.jar;c:\xerces212\xercesSamples.jar
jaxp.SourceValidator -xsd11 -fx -i "file:///d:/Temp/Xerces-J
2.12.0/XercesJ_TZ20171231_IFRS15_CBCInput_3TZ005.xml" *I doesn't recognize
"-fx" parameter, and therefore , the XSD validation is not picking up the
full XPath 2.0 for the CTAs. It gives the following errors:[Error]
IFRS15_CBC_In_XercesJ.xsd:26:185: c-cta-xpath: The XPath expression
'@OrganizationCode = ('1GT001', '1GT005', '1GT006', '1GT010', '1HN001',
'1HN003', '1SV001', '2BO002', '2PY003', '2PY007')' couldn't compile
successfully in 'cta-subset' mode, during CTA evaluation.[Error]
IFRS15_CBC_In_XercesJ.xsd:27:89: c-cta-xpath: The XPath expression
'@OrganizationCode eq '2CO001'' couldn't compile successfully in
'cta-subset' mode, during CTA evaluation.[Error]
IFRS15_CBC_In_XercesJ.xsd:28:99: c-cta-xpath: The XPath expression
'@OrganizationCode = ('2CO008', '2CO009')' couldn't compile successfully in
'cta-subset' mode, during CTA evaluation.[Error]
IFRS15_CBC_In_XercesJ.xsd:29:113: c-cta-xpath: The XPath expression
'@OrganizationCode = ('3TZ001', '3TZ002', '3TZ003', '3TZ004')' couldn't
compile successfully in 'cta-subset' mode, during CTA evaluation.[Error]
XercesJ_TZ20171231_IFRS15_CBCInput_3TZ005.xml:8:8: cvc-assertion: Assertion
evaluation ('ends-with(upper-case(string(base-uri(.))),
upper-case(concat('_', @OrganizationCode, '.xml')))') for element 'root' on
schema type '#AnonType_root' did not succeed.



--
Sent from: http://apache-xml-project.6118.n7.nabble.com/Xerces-J-Users-f4.html

Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Posted by Mukul Gandhi <mu...@apache.org>.
On Tue, Aug 7, 2018 at 9:15 PM, ykhabins <yi...@millicom.com>
wrote:

> Finally, I narrowed it down...
> There are 2 scenarios:
>
>    1. XSD file is specified inside the XML file via xsi:schemaLocation
>    attribute.
>    The -fx parameter is ignored. And it causes CTAs to fail to pick up
>    the full XPath 2.0
>    2. XSD file is specified via command line parameter *"-a"*.
>    The -fx parameter is taken into the account.
>    CTAs pick up the full XPath 2.0
>
> It is a bug.
>
 I agree. You might report this bug for the jaxp.SourceValidator, at
Xerces-J's Jira site.

also, jaxp.SourceValidator is just a sample. You might try writing a Java
component from scratch using XSD 1.1 support available in Xerces, using
JAXP API for XSD 1.1 validation. That should work I believe, for your
scenario.




-- 
Regards,
Mukul Gandhi

Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Posted by ykhabins <yi...@millicom.com>.
Hello, 
Finally, I narrowed it down...
There are 2 scenarios:
XSD file is specified inside the XML file via xsi:schemaLocation attribute.
The -fx parameter is ignored. And it causes CTAs to fail to pick up  the
full XPath 2.0
XSD file is specified via command line parameter *"-a"*.
The -fx parameter is taken into the account.
CTAs pick up the full XPath 2.0
  
It is a bug.
Here my modified command line statement:C:\Program Files\Stylus Studio X16
XML Enterprise Suite 64-bit\bin>*"c:\Program
Files\Java\jre1.8.0_181\bin\java.exe" -cp .;c:\xerces212\*
jaxp.SourceValidator -xsd11 -fx -i "file:///d:\Temp\Xerces-J
2.12.0\XercesJ_TZ20171231_IFRS15_CBCInput_3TZ005.xml" -a "d:\Temp\Xerces-J
2.12.0\IFRS15_CBC_In_XercesJ.xsd"*It gives the remaining single error (due
to base-uri(.) misbehavior):
[Error] XercesJ_TZ20171231_IFRS15_CBCInput_3TZ005.xml:8:8: cvc-assertion:
Assertion evaluation ('ends-with(upper-case(string(base-uri(.))),
upper-case(concat('_', @OrganizationCode, '.xml')))') for element 'root' on
schema type '#AnonType_root' did not succeed. 




--
Sent from: http://apache-xml-project.6118.n7.nabble.com/Xerces-J-Users-f4.html

Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Yitzhak,
   "-fx" option is working fine for me, as its described. Sorry to see
that, its not working for you for a while. May be someone else on the list,
can verify what they observe while using "-fx" option with the
jaxp.SourceValidator sample while doing XSD 1.1 validation.

Regarding use of the function base-uri(.) in the <assert>, I don't think
its a bug if its not returning the fully qualified path of the XML file
being validated. May be, we should mention in our documentation, how
base-uri(.) behaves with Xerces's use of <assert>.

On Mon, Aug 6, 2018 at 7:30 PM, Yitzhak Khabinsky <
Yitzhak.Khabinsky@millicom.com> wrote:

> Hi Mukul,
>
>
>
> With or without *“-fx”* parameter, the XSD validation is not picking up
> the full XPath 2.0 for the CTAs.
>
> Please see its screen shot below.
>
>
>
> It is a pure command line execution, no any APIs calls are involved.
>
> I provided both screen shots, with and without *“-fx”* parameter, for a
> comparison.
>
>
>
> Please advise.
>
>
>
> [image: cid:image003.png@01D42D69.16F9C270]
>
>
>
>
>
> Regards,
>
> Yitzhak Khabinsky
>
> Technical Services Lead
>
> Millicom International Services LLC
>
> 396 Alhambra Circle, Suite 1100
> <https://maps.google.com/?q=396+Alhambra+Circle,+Suite+1100+%0D%0A+Coral+Gables,+FL+33134&entry=gmail&source=g>
>
> Coral Gables, FL
> <https://maps.google.com/?q=396+Alhambra+Circle,+Suite+1100+%0D%0A+Coral+Gables,+FL+33134&entry=gmail&source=g>
> 33134
> <https://maps.google.com/?q=396+Alhambra+Circle,+Suite+1100+%0D%0A+Coral+Gables,+FL+33134&entry=gmail&source=g>
>
> Skype4B: +1 (305) 445-4172
>
> Tel: (954) 684-8673
>
> *yitzhak*.khabinsky@millicom.com
>
> www.millicom.com
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.millicom.com%2F&data=02%7C01%7CMalcolm.Stewart%40microsoft.com%7C9338023699c2494d08be08d4ad12ce55%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636323743686702678&sdata=DxQ9dfL259rpdVZ9seOAcR6bvgxRobyIerOgvTgPc90%3D&reserved=0>
>
>
>
> *From:* Yitzhak Khabinsky
> *Sent:* Friday, August 3, 2018 8:58 AM
> *To:* 'mukulg@apache.org' <mu...@apache.org>
> *Cc:* j-users@xerces.apache.org
> *Subject:* RE: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors
>
>
>
> Hi Mukul,
>
>
>
>    1. I am providing a screen shot of the XSD validation at the command
>    prompt.
>    It shows that all the needed parameters were passed, i.e. *-xsd11* and
>    *-fx*
>    I attached 3 files, including a command file cta.cmd, so you can
>    reproduce the behavior on your side.
>    2. Please confirm that the *base-uri(.)* function behavior is a bug.
>    Saxon validator is working properly.
>    Please see a screen shot below.
>
>
>
> [image: cid:image004.png@01D42D69.16F9C270]
>
>
>
>  [image: cid:image005.png@01D42D69.16F9C270]
>
> Regards,
>
> Yitzhak Khabinsky
>
> Technical Services Lead
>
> Millicom International Services LLC
>
> 396 Alhambra Circle, Suite 1100
> <https://maps.google.com/?q=396+Alhambra+Circle,+Suite+1100+%0D%0A+Coral+Gables,+FL+33134&entry=gmail&source=g>
>
> Coral Gables, FL
> <https://maps.google.com/?q=396+Alhambra+Circle,+Suite+1100+%0D%0A+Coral+Gables,+FL+33134&entry=gmail&source=g>
> 33134
> <https://maps.google.com/?q=396+Alhambra+Circle,+Suite+1100+%0D%0A+Coral+Gables,+FL+33134&entry=gmail&source=g>
>
> Skype4B: +1 (305) 445-4172
>
> Tel: (954) 684-8673
>
> *yitzhak*.khabinsky@millicom.com
>
> www.millicom.com
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.millicom.com%2F&data=02%7C01%7CMalcolm.Stewart%40microsoft.com%7C9338023699c2494d08be08d4ad12ce55%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636323743686702678&sdata=DxQ9dfL259rpdVZ9seOAcR6bvgxRobyIerOgvTgPc90%3D&reserved=0>
>
>
>
> *From:* Mukul Gandhi [mailto:mukulg@apache.org <mu...@apache.org>]
> *Sent:* Friday, August 3, 2018 1:04 AM
> *To:* Yitzhak Khabinsky <Yi...@Millicom.com>
> *Cc:* j-users@xerces.apache.org
> *Subject:* Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors
>
>
>
> Hi Yitzhak,
>
>
>
> On Thu, Aug 2, 2018 at 6:57 PM, Yitzhak Khabinsky <
> Yitzhak.Khabinsky@millicom.com> wrote:
>
>
>    1. The CTA expression continues to trip on search in sequences.
>    The error message says  “…couldn't compile successfully…”
>    2. The CTA expression doesn’t accept “eq” instead of “=”.
>    The error message says  “…couldn't compile successfully…”
>
> I did test your XML and XSD sample that you attached most recently. While
> doing XSD 1.1 validation using the Xerces sample jaxp.SourceValidator, when
> I don't give an option -fx I get errors for CTA XPath expressions saying,
> "couldn't compile successfully". But when I give option -fx, I don't get
> that error.
>
>
>
> It seems, there's some other issue on your side that I don't reproduce.
>
>
>
>
>
>
>    1.
>    2. It seems that the *base-uri(.)* function call is failing to return
>    the fully qualified path to the XML file that is being validated.
>
>
>    1. Saxon’s *base-uri(.)* function call correctly emits the following:
>       file:///d:/Temp/CDW/IFRS/Tanzania/id2938_TZ20171231_
>       IFRS15_CBCInput_3TZ005.xml
>
> You seem to be using the base-uri(.) function in your xs:assert. As I said
> earlier, Xerces's xs:assert evaluation does not preserve the URI of XML
> file that is being validated, that can be returned by the base-uri(.) call
> in an xs:assert. Therefore, while using XSD 1.1 validation (specifically
> using xs:assert) with Xerces, you shouldn't rely on the value of
> base-uri(.).
>





-- 
Regards,
Mukul Gandhi

RE: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Posted by Yitzhak Khabinsky <Yi...@Millicom.com>.
Hi Mukul,

With or without “-fx” parameter, the XSD validation is not picking up the full XPath 2.0 for the CTAs.
Please see its screen shot below.

It is a pure command line execution, no any APIs calls are involved.
I provided both screen shots, with and without “-fx” parameter, for a comparison.

Please advise.

[cid:image003.png@01D42D69.16F9C270]


Regards,
Yitzhak Khabinsky
Technical Services Lead
Millicom International Services LLC
396 Alhambra Circle, Suite 1100
Coral Gables, FL  33134
Skype4B: +1 (305) 445-4172
Tel: (954) 684-8673
yitzhak.khabinsky@millicom.com<ma...@millicom.com>
www.millicom.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.millicom.com%2F&data=02%7C01%7CMalcolm.Stewart%40microsoft.com%7C9338023699c2494d08be08d4ad12ce55%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636323743686702678&sdata=DxQ9dfL259rpdVZ9seOAcR6bvgxRobyIerOgvTgPc90%3D&reserved=0>

From: Yitzhak Khabinsky
Sent: Friday, August 3, 2018 8:58 AM
To: 'mukulg@apache.org' <mu...@apache.org>
Cc: j-users@xerces.apache.org
Subject: RE: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Hi Mukul,


  1.  I am providing a screen shot of the XSD validation at the command prompt.
It shows that all the needed parameters were passed, i.e. -xsd11 and -fx
I attached 3 files, including a command file cta.cmd, so you can reproduce the behavior on your side.
  2.  Please confirm that the base-uri(.) function behavior is a bug.
Saxon validator is working properly.
Please see a screen shot below.

[cid:image004.png@01D42D69.16F9C270]

 [cid:image005.png@01D42D69.16F9C270]
Regards,
Yitzhak Khabinsky
Technical Services Lead
Millicom International Services LLC
396 Alhambra Circle, Suite 1100
Coral Gables, FL  33134
Skype4B: +1 (305) 445-4172
Tel: (954) 684-8673
yitzhak.khabinsky@millicom.com<ma...@millicom.com>
www.millicom.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.millicom.com%2F&data=02%7C01%7CMalcolm.Stewart%40microsoft.com%7C9338023699c2494d08be08d4ad12ce55%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636323743686702678&sdata=DxQ9dfL259rpdVZ9seOAcR6bvgxRobyIerOgvTgPc90%3D&reserved=0>

From: Mukul Gandhi [mailto:mukulg@apache.org]
Sent: Friday, August 3, 2018 1:04 AM
To: Yitzhak Khabinsky <Yi...@Millicom.com>>
Cc: j-users@xerces.apache.org<ma...@xerces.apache.org>
Subject: Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Hi Yitzhak,

On Thu, Aug 2, 2018 at 6:57 PM, Yitzhak Khabinsky <Yi...@millicom.com>> wrote:

  1.  The CTA expression continues to trip on search in sequences.
The error message says  “…couldn't compile successfully…”
  2.  The CTA expression doesn’t accept “eq” instead of “=”.
The error message says  “…couldn't compile successfully…”
I did test your XML and XSD sample that you attached most recently. While doing XSD 1.1 validation using the Xerces sample jaxp.SourceValidator, when I don't give an option -fx I get errors for CTA XPath expressions saying, "couldn't compile successfully". But when I give option -fx, I don't get that error.

It seems, there's some other issue on your side that I don't reproduce.



  1.
  2.  It seems that the base-uri(.) function call is failing to return the fully qualified path to the XML file that is being validated.

     *   Saxon’s base-uri(.) function call correctly emits the following:
file:///d:/Temp/CDW/IFRS/Tanzania/id2938_TZ20171231_IFRS15_CBCInput_3TZ005.xml
You seem to be using the base-uri(.) function in your xs:assert. As I said earlier, Xerces's xs:assert evaluation does not preserve the URI of XML file that is being validated, that can be returned by the base-uri(.) call in an xs:assert. Therefore, while using XSD 1.1 validation (specifically using xs:assert) with Xerces, you shouldn't rely on the value of base-uri(.).





--
Regards,
Mukul Gandhi

Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

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

On Thu, Aug 2, 2018 at 6:57 PM, Yitzhak Khabinsky <
Yitzhak.Khabinsky@millicom.com> wrote:
>
>
>    1. The CTA expression continues to trip on search in sequences.
>    The error message says  “…couldn't compile successfully…”
>    2. The CTA expression doesn’t accept “eq” instead of “=”.
>    The error message says  “…couldn't compile successfully…”
>
> I did test your XML and XSD sample that you attached most recently. While
doing XSD 1.1 validation using the Xerces sample jaxp.SourceValidator, when
I don't give an option -fx I get errors for CTA XPath expressions saying,
"couldn't compile successfully". But when I give option -fx, I don't get
that error.

It seems, there's some other issue on your side that I don't reproduce.



>
>    1.
>    2. It seems that the *base-uri(.)* function call is failing to return
>    the fully qualified path to the XML file that is being validated.
>       1. Saxon’s *base-uri(.)* function call correctly emits the
>       following:
>       file:///d:/Temp/CDW/IFRS/Tanzania/id2938_TZ20171231_
>       IFRS15_CBCInput_3TZ005.xml
>
> You seem to be using the base-uri(.) function in your xs:assert. As I said
earlier, Xerces's xs:assert evaluation does not preserve the URI of XML
file that is being validated, that can be returned by the base-uri(.) call
in an xs:assert. Therefore, while using XSD 1.1 validation (specifically
using xs:assert) with Xerces, you shouldn't rely on the value of
base-uri(.).





-- 
Regards,
Mukul Gandhi

RE: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Posted by Yitzhak Khabinsky <Yi...@Millicom.com>.
Hello,

Thanks for your reply.

The minimalistic test case XML/XSD is in the attachment.

Again for comparison, Saxon doesn’t complain about the CTAs and the base-uri() in the XSD.


  1.  The CTA expression continues to trip on search in sequences.
The error message says  “…couldn't compile successfully…”
  2.  The CTA expression doesn’t accept “eq” instead of “=”.
The error message says  “…couldn't compile successfully…”
  3.  It seems that the base-uri(.) function call is failing to return the fully qualified path to the XML file that is being validated.
     *   Saxon’s base-uri(.) function call correctly emits the following:
file:///d:/Temp/CDW/IFRS/Tanzania/id2938_TZ20171231_IFRS15_CBCInput_3TZ005.xml

Command Line
C:\Program Files\Stylus Studio X16 XML Enterprise Suite 64-bit\bin>"c:\Program Files\Java\jre1.8.0_181\bin\java.exe"  -Xms512m -Xmx1024m -Xbootclasspath/p:path:;c:\xerces212\xercesImpl.jar;c:\xerces212\xml-apis.jar;c:\xerces212\org.eclipse.wst.xml.xpath2.processor_1.2.0.jar;c:\xerces212\icu4j.jar;c:\xerces212\resolver.jar;c:\xerces212\serializer.jar;c:\xerces212\cupv10k-runtime.jar;c:\xerces212\xercesSamples.jar jaxp.SourceValidator -xsd11 -fx -i "file:///d:/Temp/CDW/IFRS/Tanzania/XercesJ_TZ20171231_IFRS15_CBCInput_3TZ005.xml"

List of errors
[Error] IFRS15_CBC_In_XercesJ.xsd:26:185: c-cta-xpath: The XPath expression '@OrganizationCode = ('1GT001', '1GT005', '1GT006', '1GT010', '1HN001', '1HN003', '1SV001', '2BO002', '2PY003', '2PY007')' couldn't compile successfully in 'cta-subset' mode, during CTA evaluation.
[Error] IFRS15_CBC_In_XercesJ.xsd:27:89: c-cta-xpath: The XPath expression '@OrganizationCode eq '2CO001'' couldn't compile successfully in 'cta-subset' mode, during CTA evaluation.
[Error] IFRS15_CBC_In_XercesJ.xsd:28:99: c-cta-xpath: The XPath expression '@OrganizationCode = ('2CO008', '2CO009')' couldn't compile successfully in 'cta-subset' mode, during CTA evaluation.
[Error] IFRS15_CBC_In_XercesJ.xsd:29:113: c-cta-xpath: The XPath expression '@OrganizationCode = ('3TZ001', '3TZ002', '3TZ003', '3TZ004')' couldn't compile successfully in 'cta-subset' mode, during CTA evaluation.
[Error] XercesJ_TZ20171231_IFRS15_CBCInput_3TZ005.xml:8:8: cvc-assertion: Assertion evaluation ('ends-with(upper-case(string(base-uri(.))), upper-case(concat('_', @OrganizationCode, '.xml')))') for element 'root' on schema type '#AnonType_root' did not succeed.

P.S. “…Please do write to the list. This way, other list members could also reply to the query…”
My initial e-mail has j-users@xerces.apache.org<ma...@xerces.apache.org> e-mail as one of the recipients.

Regards,
Yitzhak Khabinsky
Technical Services Lead
Millicom International Services LLC
396 Alhambra Circle, Suite 1100
Coral Gables, FL  33134
Skype4B: +1 (305) 445-4172
Tel: (954) 684-8673
yitzhak.khabinsky@millicom.com<ma...@millicom.com>
www.millicom.com<https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.millicom.com%2F&data=02%7C01%7CMalcolm.Stewart%40microsoft.com%7C9338023699c2494d08be08d4ad12ce55%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636323743686702678&sdata=DxQ9dfL259rpdVZ9seOAcR6bvgxRobyIerOgvTgPc90%3D&reserved=0>

From: Mukul Gandhi [mailto:mukulg@apache.org]
Sent: Thursday, August 2, 2018 2:59 AM
To: Yitzhak Khabinsky <Yi...@Millicom.com>
Cc: j-users@xerces.apache.org
Subject: Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Hi Yitzhak,
   It would be ok, if you don't direct the question only to me. Please do write to the list. This way, other list members could also reply to the query.

Anyway, I've analyzed about your doubts and below are my thoughts.

On Thu, Aug 2, 2018 at 12:14 AM, Yitzhak Khabinsky <Yi...@millicom.com>> wrote:

  *   I added the -fx parameter (to turn on full XPath 2.0 checks with CTA when working with XSD 1.1), but it didn’t help.
The -fx option in the sample jaxp.SourceValidator works correctly. If enabled, it will cause full XPath 2.0 language to be available in the CTA XPath expressions.


  *   The CTA expression doesn’t accept “eq” instead of “=”:
<xs:alternative test="@OrganizationCode eq '3TZ005'" type="AccountCode-TZ-Zantel"/>
I don't think, there's an issue with the XPath 2.0 "eq" operator implementation in Xerces. I hope you know following,
"eq" does value comparison. i.e it is used for comparing single values. For e.g, 1 eq 1 would return true, and 1 eq 2 would return false.
"=" is a general comparison operator (it can accept sequences as arguments).
For e.g, 1 = (1,2) would return true. 1 eq (1,2) would result in a run-time error.

> It seems that the base-uri(.) function call is failing to return the fully qualified path to the XML file that is being validated.

I don't think, this is a Xerces bug. If you write base-uri(node-ref) in an xs:assert XPath expression, with Xerces you would get a zero length string as result. When evaluating xs:assert with Xerces, an in-memory DOM tree is constructed before passing that DOM to the XPath 2.0 processor. We don't set the base-uri on any of the nodes in this DOM. It can be little debatable, whether this is correct or not. My personal opinion is, that this is compliant.

If we look at our XPath 2.0 processor as stand-alone library, base-uri(node-ref) is computed correctly. For e.g, with the URL http://www.w3schools.com/xml/note.xml, evaluating 'string(base-uri(note))' returns "http://www.w3schools.com/xml/note.xml".

For the future, requesting you to please provide a minimal XML and XSD sample that is focused only on the actual issue. That makes it easier to debug on our side.




--
Regards,
Mukul Gandhi

Re: Xerces-J 2.12.0 vs. Saxon: XSD 1.1 CTA validation errors

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Yitzhak,
   It would be ok, if you don't direct the question only to me. Please do
write to the list. This way, other list members could also reply to the
query.

Anyway, I've analyzed about your doubts and below are my thoughts.

On Thu, Aug 2, 2018 at 12:14 AM, Yitzhak Khabinsky <
Yitzhak.Khabinsky@millicom.com> wrote:
>
>
>    - I added the *-fx* parameter (to turn on full XPath 2.0 checks with
>    CTA when working with XSD 1.1), but it didn’t help.
>
> The -fx option in the sample jaxp.SourceValidator works correctly. If
enabled, it will cause full XPath 2.0 language to be available in the CTA
XPath expressions.


>    - The CTA expression doesn’t accept “eq” instead of “=”:
>    <xs:alternative test="@OrganizationCode eq '3TZ005'" type=
>    "AccountCode-TZ-Zantel"/>
>
> I don't think, there's an issue with the XPath 2.0 "eq" operator
implementation in Xerces. I hope you know following,
"eq" does value comparison. i.e it is used for comparing single values. For
e.g, 1 eq 1 would return true, and 1 eq 2 would return false.
"=" is a general comparison operator (it can accept sequences as arguments).
For e.g, 1 = (1,2) would return true. 1 eq (1,2) would result in a run-time
error.

> It seems that the *base-uri(.)* function call is failing to return the
fully qualified path to the XML file that is being validated.

I don't think, this is a Xerces bug. If you write base-uri(node-ref) in an
xs:assert XPath expression, with Xerces you would get a zero length string
as result. When evaluating xs:assert with Xerces, an in-memory DOM tree is
constructed before passing that DOM to the XPath 2.0 processor. We don't
set the base-uri on any of the nodes in this DOM. It can be little
debatable, whether this is correct or not. My personal opinion is, that
this is compliant.

If we look at our XPath 2.0 processor as stand-alone library,
base-uri(node-ref) is computed correctly. For e.g, with the URL
http://www.w3schools.com/xml/note.xml, evaluating 'string(base-uri(note))'
returns "http://www.w3schools.com/xml/note.xml".

For the future, requesting you to please provide a minimal XML and XSD
sample that is focused only on the actual issue. That makes it easier to
debug on our side.




-- 
Regards,
Mukul Gandhi