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<mailto:j-users@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.khabin...@millicom.com<mailto:.khabin...@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:muk...@apache.org]
Sent: Thursday, August 2, 2018 2:59 AM
To: Yitzhak Khabinsky <yitzhak.khabin...@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 
<yitzhak.khabin...@millicom.com<mailto:yitzhak.khabin...@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

Attachment: XercesJ_TZ20171231_IFRS15_CBCInput_3TZ005.xml
Description: XercesJ_TZ20171231_IFRS15_CBCInput_3TZ005.xml

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" version="1.06" targetNamespace="http://www.millicom.com"; xmlns="http://www.millicom.com"; xpathDefaultNamespace="##targetNamespace" xmlns:saxon="http://saxon.sf.net/"; xmlns:math="http://www.w3.org/2005/xpath-functions/math";>
	<xs:element name="root">
		<xs:complexType>
			<xs:sequence>
				<xs:element minOccurs="1" maxOccurs="unbounded" ref="r"/>
			</xs:sequence>
			<xs:attribute name="OrganizationCode" inheritable="true" use="required" type="OrganizationCodeType"/>

			<xs:assert test="ends-with(upper-case(string(base-uri(.))), upper-case(concat('_', @OrganizationCode, '.xml')))" saxon:message="Rule #21: OrganizationCode shall match XML file naming convention" xpathDefaultNamespace="##targetNamespace">
				<xs:annotation>
					<xs:documentation>Rule #21</xs:documentation>
					<xs:documentation>OrganizationCode shall match XML file naming convention</xs:documentation>
				</xs:annotation>
			</xs:assert>
		</xs:complexType>

	</xs:element>

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

	<xs:simpleType name="AccountCode-GT-HN-SV-BO-PY">
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:maxLength value="8"/>
			<xs:enumeration value="41010101"/>
			<xs:enumeration value="41010102"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="OrganizationCodeType">
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:maxLength value="6"/>
			<xs:enumeration value="1CR001"/>
			<xs:enumeration value="1CR002"/>
			<xs:enumeration value="1CR003"/>
			<xs:enumeration value="1GT000"/>
			<xs:enumeration value="1GT001"/>
			<xs:enumeration value="1GT002"/>
			<xs:enumeration value="1GT003"/>
			<xs:enumeration value="1GT004"/>
			<xs:enumeration value="1GT005"/>
			<xs:enumeration value="1GT006"/>
			<xs:enumeration value="1GT007"/>
			<xs:enumeration value="1GT008"/>
			<xs:enumeration value="1GT009"/>
			<xs:enumeration value="1GT010"/>
			<xs:enumeration value="1GT011"/>
			<xs:enumeration value="1GT012"/>
			<xs:enumeration value="1GT013"/>
			<xs:enumeration value="1GT014"/>
			<xs:enumeration value="1GT015"/>
			<xs:enumeration value="1GT016"/>
			<xs:enumeration value="1GT017"/>
			<xs:enumeration value="1HN001"/>
			<xs:enumeration value="1HN002"/>
			<xs:enumeration value="1HN003"/>
			<xs:enumeration value="1HN004"/>
			<xs:enumeration value="1HN005"/>
			<xs:enumeration value="1HN006"/>
			<xs:enumeration value="1HN007"/>
			<xs:enumeration value="1HN008"/>
			<xs:enumeration value="1HN009"/>
			<xs:enumeration value="1HNCEL"/>
			<xs:enumeration value="1HNMCB"/>
			<xs:enumeration value="1HNNAV"/>
			<xs:enumeration value="1NI001"/>
			<xs:enumeration value="1NI002"/>
			<xs:enumeration value="1NI003"/>
			<xs:enumeration value="1NI004"/>
			<xs:enumeration value="1NI005"/>
			<xs:enumeration value="1SV001"/>
			<xs:enumeration value="1SV002"/>
			<xs:enumeration value="1SV003"/>
			<xs:enumeration value="1SV004"/>
			<xs:enumeration value="1SV005"/>
			<xs:enumeration value="1SV006"/>
			<xs:enumeration value="1SV007"/>
			<xs:enumeration value="1SV008"/>
			<xs:enumeration value="1SV009"/>
			<xs:enumeration value="1SV010"/>
			<xs:enumeration value="1SV011"/>
			<xs:enumeration value="1SV012"/>
			<xs:enumeration value="1SV013"/>
			<xs:enumeration value="1SV014"/>
			<xs:enumeration value="1SV015"/>
			<xs:enumeration value="1SV016"/>
			<xs:enumeration value="1SV017"/>
			<xs:enumeration value="1SV018"/>
			<xs:enumeration value="1SV019"/>
			<xs:enumeration value="1SV020"/>
			<xs:enumeration value="1SV021"/>
			<xs:enumeration value="1SV022"/>
			<xs:enumeration value="1SV023"/>
			<xs:enumeration value="1SVMCB"/>
			<xs:enumeration value="1SVTLM"/>
			<xs:enumeration value="2BO001"/>
			<xs:enumeration value="2BO002"/>
			<xs:enumeration value="2BO003"/>
			<xs:enumeration value="2CO001"/>
			<xs:enumeration value="2CO002"/>
			<xs:enumeration value="2CO003"/>
			<xs:enumeration value="2CO004"/>
			<xs:enumeration value="2CO008"/>
			<xs:enumeration value="2CO009"/>
			<xs:enumeration value="2CO010"/>
			<xs:enumeration value="2CO011"/>
			<xs:enumeration value="2CO012"/>
			<xs:enumeration value="2PY001"/>
			<xs:enumeration value="2PY002"/>
			<xs:enumeration value="2PY003"/>
			<xs:enumeration value="2PY004"/>
			<xs:enumeration value="2PY005"/>
			<xs:enumeration value="2PY006"/>
			<xs:enumeration value="2PY007"/>
			<xs:enumeration value="2PY008"/>
			<xs:enumeration value="2PYA00"/>
			<xs:enumeration value="2PYA01"/>
			<xs:enumeration value="2PYA02"/>
			<xs:enumeration value="2PYA03"/>
			<xs:enumeration value="2PYA04"/>
			<xs:enumeration value="2PYA05"/>
			<xs:enumeration value="3GH001"/>
			<xs:enumeration value="3GH002"/>
			<xs:enumeration value="3GH003"/>
			<xs:enumeration value="3RW001"/>
			<xs:enumeration value="3TD001"/>
			<xs:enumeration value="3TD002"/>
			<xs:enumeration value="3TZ001"/>
			<xs:enumeration value="3TZ002"/>
			<xs:enumeration value="3TZ003"/>
			<xs:enumeration value="3TZ004"/>
			<xs:enumeration value="3TZ005"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="AccountCode-CO-Mobile">
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:maxLength value="10"/>
			<xs:enumeration value="4210271001"/>
			<xs:enumeration value="4210271002"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="AccountCode-CO-Fixed">
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:maxLength value="10"/>
			<xs:enumeration value="4210260000"/>
			<xs:enumeration value="4210270000"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="AccountCode-TZ">
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:maxLength value="7"/>
			<xs:enumeration value="1250007"/>
			<xs:enumeration value="6110001"/>
		</xs:restriction>
	</xs:simpleType>

	<xs:simpleType name="AccountCode-TZ-Zantel">
		<xs:restriction base="xs:string">
			<xs:whiteSpace value="preserve"/>
			<xs:maxLength value="6"/>
			<xs:enumeration value="410006"/>
			<xs:enumeration value="470011"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to